MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / CopyButton

Function CopyButton

freebuff/web/src/components/copy-button.tsx:8–39  ·  view source on GitHub ↗
({
  value,
  className,
}: {
  value: string
  className?: string
})

Source from the content-addressed store, hash-verified

6import { cn } from '@/lib/utils'
7
8export function CopyButton({
9 value,
10 className,
11}: {
12 value: string
13 className?: string
14}) {
15 const [copied, setCopied] = useState(false)
16
17 const handleCopy = () => {
18 navigator.clipboard.writeText(value)
19 setCopied(true)
20 setTimeout(() => setCopied(false), 2000)
21 }
22
23 return (
24 <button
25 onClick={handleCopy}
26 className={cn(
27 'p-1.5 rounded-md transition-colors hover:bg-white/10',
28 className,
29 )}
30 aria-label={`Copy: ${value}`}
31 >
32 {copied ? (
33 <Check className="h-4 w-4 text-acid-matrix" />
34 ) : (
35 <Copy className="h-4 w-4 text-white/60" />
36 )}
37 </button>
38 )
39}

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected