import { useCopy } from "~/hooks/use-copy"; import { cn } from "~/utils/cn"; type Props = { title?: string; source: string; className?: string }; function lineClass(line: string): string { return line.trimStart().startsWith("#") ? "text-gray-500" : "text-gray-200"; } /** Read-only snippet with a title bar and copy button. Comment lines (`#`) are dimmed. */ export function CodeBlock({ title, source, className }: Props) { const { copied, copy } = useCopy(); return (
{title}
        
          {source.split("\n").map((line, index) => (
            // oxlint-disable-next-line react/no-array-index-key -- lines are static and may repeat
            
              {line || " "}
            
          ))}
        
      
); }