import React, { useState } from 'react' import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism' import { Copy, Check } from 'lucide-react' interface CodeBlockProps { language?: string value: string inline?: boolean } export const CodeBlock: React.FC = ({ language, value, inline }) => { const [copied, setCopied] = useState(false) const handleCopy = async () => { await navigator.clipboard.writeText(value) setCopied(true) setTimeout(() => setCopied(false), 2000) } // Inline code if (inline) { return ( {value} ) } // Block code return (
{language || 'plaintext'}
3} > {value}
) }