import { useState } from "react"; import { Copy, Check } from "lucide-react"; export function CodeBlock({ content }) { const [copied, setCopied] = useState(false); const code = content.code ?? ""; const language = content.language ?? "text"; const handleCopy = () => { navigator.clipboard.writeText(code).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); }); }; if (!code) { return (
{code}