import { useState } from "react"; import { Check, Copy } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark, oneLight, } from "react-syntax-highlighter/dist/esm/styles/prism"; import { cn } from "@/lib/utils"; interface CodeBlockProps { language?: string; code: string; className?: string; } export function CodeBlock({ language, code, className }: CodeBlockProps) { const { t } = useTranslation(); const [copied, setCopied] = useState(false); const onCopy = () => { if (!navigator.clipboard) return; navigator.clipboard.writeText(code).then(() => { setCopied(true); setTimeout(() => setCopied(false), 1_500); }); }; const isDark = typeof window !== "undefined" ? document.documentElement.classList.contains("dark") : true; return (