import { useSignal } from "@preact/signals"; import Prism from "https://esm.sh/prismjs@1.27.0"; import "https://esm.sh/prismjs@1.27.0/components/prism-typescript?no-check"; interface CodeBoxProps { code: string; } export default function CodeBox(props: CodeBoxProps) { const highlighted = Prism.highlight( props.code, Prism.languages.typescript, "typescript", ); const onCopy = () => { navigator.clipboard.writeText(props.code); copied.value = true; }; const copied = useSignal(false); return (