'use client'; import { useState } from 'react'; import { Check, Copy } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; export function CodeBlock({ code, language, title }: { code: string; language?: string; title?: string }) { const [copied, setCopied] = useState(false); async function copy() { await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 2000); } return (
{(title || language) && (
{title ?? language}
)}
        {code}
      
{!title && !language && ( )}
); }