"use client"; import { useState } from "react"; export function CopyLinkButton({ anchor }: { anchor: string }) { const [copied, setCopied] = useState(false); const onClick = async () => { try { const { origin, pathname } = window.location; await navigator.clipboard.writeText(`${origin}${pathname}#${anchor}`); setCopied(true); window.setTimeout(() => setCopied(false), 1200); } catch { // clipboard write failed — silently no-op; user can still click the heading } }; return ( ); }