import { useState } from "react"; export default function CopyButton({ text }: { text: string }) { const [copied, setCopied] = useState(false); async function handleCopy() { try { await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { // Clipboard API unavailable (e.g. insecure context) — nothing more we can do. } } return ( ); }