({
text,
className,
}: {
text: string
className?: string
})
| 5 | import { cn } from "../lib/utils" |
| 6 | |
| 7 | export function CopyButton({ |
| 8 | text, |
| 9 | className, |
| 10 | }: { |
| 11 | text: string |
| 12 | className?: string |
| 13 | }) { |
| 14 | const [copied, setCopied] = React.useState(false) |
| 15 | |
| 16 | return ( |
| 17 | <button |
| 18 | className={cn( |
| 19 | `hover:bg-gray-400/20 -m-1 p-1 rounded hidden sm:block`, |
| 20 | className, |
| 21 | )} |
| 22 | onClick={() => { |
| 23 | navigator.clipboard.writeText(text) |
| 24 | setCopied(true) |
| 25 | setTimeout(() => setCopied(false), 1200) |
| 26 | }} |
| 27 | aria-label="Copy to clipboard" |
| 28 | > |
| 29 | {copied ? <Check size={16} /> : <Copy size={16} />} |
| 30 | </button> |
| 31 | ) |
| 32 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…