diff --git a/packages/special-pages/pages/special-error/app/components/AdvancedInfo.jsx b/packages/special-pages/pages/special-error/app/components/AdvancedInfo.jsx index 978ec0ab45..c042f1c699 100644 --- a/packages/special-pages/pages/special-error/app/components/AdvancedInfo.jsx +++ b/packages/special-pages/pages/special-error/app/components/AdvancedInfo.jsx @@ -1,7 +1,7 @@ import { h } from 'preact' import { useRef, useEffect } from 'preact/hooks' import { useTypedTranslation } from '../types' -import { Text } from '../../../../shared/components/Text/Text' +import { Text, Link } from '../../../../shared/components/Text/Text' import { useMessaging } from '../providers/MessagingProvider' import { useAdvancedInfoHeading, useAdvancedInfoContent } from '../hooks/ErrorStrings' @@ -28,9 +28,9 @@ export function VisitSiteLink() { }, []) return ( - messaging?.visitSite()}> + messaging?.visitSite()}> {t('visitSiteButton')} - + ) } @@ -56,7 +56,7 @@ export function AdvancedInfoContent() { export function AdvancedInfo() { const animationDidEnd = () => { - window.dispatchEvent(new CustomEvent('advanced-info-animation-end')) + window.dispatchEvent(new Event('advanced-info-animation-end')) } return ( diff --git a/packages/special-pages/shared/components/Text/Text.js b/packages/special-pages/shared/components/Text/Text.js index 4602d7f340..4f4b046807 100644 --- a/packages/special-pages/shared/components/Text/Text.js +++ b/packages/special-pages/shared/components/Text/Text.js @@ -9,21 +9,28 @@ import styles from './Text.module.css' * @param {string} [props.className] * @param {boolean} [props.strictSpacing] - Apply Design System letter spacing. Default: true * @param {import("preact").ComponentChild} [props.children] - * @param {import("preact").JSX.MouseEventHandler} [props.onClick] */ -export function Text ({ as: Comp = 'p', variant, strictSpacing = true, className, children, onClick }) { +export function Text ({ as: Comp = 'p', variant, strictSpacing = true, className, children }) { return ( - } event - */ - (event) => { - if (onClick) { - onClick(event) - } - }}> + {children} ) } + +/** + * @param {object} props + * @param {Omit} [props.variant] + * @param {string} [props.className] + * @param {boolean} [props.strictSpacing] - Apply Design System letter spacing. Default: true + * @param {import('preact').JSX.MouseEventHandler} props.onClick + * @param {import("preact").ComponentChild} [props.children] + * @param {import("preact").ComponentProps<"a">} [props.anchorProps] + */ +export function Link ({ variant, strictSpacing = true, className, children, onClick, anchorProps = {} }) { + return ( + + {children} + + ) +} diff --git a/src/dom-utils.js b/src/dom-utils.js index 7557511428..0784fa6455 100644 --- a/src/dom-utils.js +++ b/src/dom-utils.js @@ -67,21 +67,6 @@ export function trustedUnsafe (string) { return html([string]) } -/** - * @param {string} string - * @return {Template} - */ -export function trustedUnsafeEscaped (string) { - const decoded = decodeHtml(string) - return html([decoded]) -} - -export function decodeHtml (html) { - const txt = document.createElement('textarea') - txt.innerHTML = html - return txt.value -} - /** * Use a policy if trustedTypes is available * @return {{createHTML: (s: string) => any}}