Skip to content

Commit

Permalink
Enhancement: support hrefs for info widgets (#4347)
Browse files Browse the repository at this point in the history
Co-authored-by: shamoon <[email protected]>
  • Loading branch information
DamitusThyYeetus123 and shamoon authored Nov 28, 2024
1 parent aaf4a3e commit 230da3d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/widgets/widget/container.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import classNames from "classnames";
import { useContext } from "react";

import WidgetIcon from "./widget_icon";
import PrimaryText from "./primary_text";
import SecondaryText from "./secondary_text";
import Raw from "./raw";

import { SettingsContext } from "utils/contexts/settings";

export function getAllClasses(options, additionalClassNames = "") {
if (options?.style?.header === "boxedWidgets") {
if (options?.style?.cardBlur !== undefined) {
Expand Down Expand Up @@ -56,7 +59,17 @@ export function getBottomBlock(children) {
}

export default function Container({ children = [], options, additionalClassNames = "" }) {
return (
const { settings } = useContext(SettingsContext);
return options.href ? (
<a
href={options.href}
target={options.target ?? settings.target ?? "_blank"}
className={getAllClasses(options, `${additionalClassNames} widget-container`)}
>
{getInnerBlock(children)}
{getBottomBlock(children)}
</a>
) : (
<div className={getAllClasses(options, `${additionalClassNames} widget-container`)}>
{getInnerBlock(children)}
{getBottomBlock(children)}
Expand Down

0 comments on commit 230da3d

Please sign in to comment.