File size: 547 Bytes
37f231b
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// website/src/components/CopyButton.jsx
import { useState } from 'react';
export default function CopyButton({ text, className = '' }) {
  const [copied, setCopied] = useState(false);
  const copy = async () => {
    try { await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch {}
  };
  return (
    <button onClick={copy} className={`text-[11px] font-mono text-muted hover:text-ink transition-colors ${className}`} title="Copy">
      {copied ? '✓ copied' : 'copy'}
    </button>
  );
}