--- import { Icon } from "astro-icon/components"; import { announcementConfig } from "@/config/announcementConfig"; import I18nKey from "@/i18n/i18nKey"; import { i18n } from "@/i18n/translation"; import WidgetLayout from "./WidgetLayout.astro"; const config = announcementConfig; interface Props { class?: string; style?: string; } const className = Astro.props.class; const style = Astro.props.style; const contentText = config.content || config.text || ""; const link = config.link; const hasLink = link && link.enable !== false && link.text && link.url; const isExternal = hasLink && (link.external === true || (/^https?:\/\//i.test(link.url) && link.external !== false)); const closeDuration = Number(config.closeDuration ?? 86400); --- {contentText && (
{contentText}
{(hasLink || config.closable) && (
{hasLink && ( {link.text} {isExternal && ( )} )}
{config.closable && ( )}
)}
)}