'use client' import * as React from 'react' import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' import { oneDark, oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism' import { Copy, Check } from 'lucide-react' import { Button } from '@/components/ui/button' import { cn } from '@/lib/utils' import { useUIStore } from '@/stores/ui' export function CodeBlock({ language, code }: { language: string; code: string }) { const [copied, setCopied] = React.useState(false) const theme = useUIStore((s) => s.theme) const isDark = typeof document !== 'undefined' && document.documentElement.classList.contains('dark') const onCopy = async () => { await navigator.clipboard.writeText(code) setCopied(true) setTimeout(() => setCopied(false), 1500) } return (
{children}
}