import {motion} from 'framer-motion'; import React, {useState} from 'react'; import {Check, Copy} from 'lucide-react'; interface CodeBlockProps { code: string; language?: string; title?: string; showCopy?: boolean; } /** * Reusable code block component with syntax highlighting styling and copy functionality */ export function CodeBlock({code, language = 'javascript', title, showCopy = true}: CodeBlockProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return ( {(title || showCopy) && (
{title && {title}} {!title && {language}} {showCopy && ( )}
)}
        {code}
      
); }