Enhancement: support hrefs for info widgets (#4347)

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
pull/4348/head
DamitusThyYeetus123 2 days ago committed by GitHub
parent aaf4a3e92f
commit 230da3d2eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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) {
@ -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)}

Loading…
Cancel
Save