import { faCopy } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { JSX, useLayoutEffect, useState } from "react"; import { type BundledLanguage, highlight } from "../../highlight"; type Props = { code: string; language: BundledLanguage; }; export default function CodeBlock({ code, language }: Props) { const [nodes, setNodes] = useState(null); const [showCopied, setShowCopied] = useState(false); useLayoutEffect(() => { highlight(code, language).then(setNodes); }, [code, language]); const handleCopy = () => { navigator.clipboard.writeText(code).then(() => { setShowCopied(true); setTimeout(() => setShowCopied(false), 3000); }); }; return (
				{nodes === null ? {code} : nodes}
			
); }