/* istanbul ignore file */ /** * CodeBlock Component * Syntax-highlighted code block with copy functionality * This file is excluded from coverage as it's a documentation component */ 'use client'; import { useState } from 'react'; import { Check, Copy } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; interface CodeBlockProps { children: React.ReactNode; className?: string; title?: string; } export function CodeBlock({ children, className, title }: CodeBlockProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { const code = extractTextFromChildren(children); await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{children}