mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-03 14:03:40 +01:00
Enhancement: support hrefs for info widgets (#4347)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
aaf4a3e92f
commit
230da3d2eb
@ -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…
x
Reference in New Issue
Block a user