ultron1 / website /src /components /CopyButton.jsx
ghostdrive1's picture
v26: complete website — Projects live, Sentinel live topology, 4 new components, CF Worker updated, api.js complete
37f231b
Raw
History Blame Contribute Delete
547 Bytes
// 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>
);
}