import { useState } from 'react'; import Highlight from 'react-highlight'; import 'highlight.js/styles/atom-one-light.css'; interface CodeBlockProps { code: string; language?: 'json' | 'xml' | 'javascript' | 'typescript' | 'css' | 'html' | 'plaintext'; showLineNumbers?: boolean; maxHeight?: string; className?: string; } export function CodeBlock({ code, language = 'plaintext', showLineNumbers = false, maxHeight = 'none', className = '', }: CodeBlockProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{code || '// Empty'}
); }