import { Check, Copy } from "lucide-react"; import * as React from "react"; import { cn } from "@/shared/lib/cn"; import { writeTextToClipboard } from "@/shared/lib/clipboard"; /** Icon button that copies arbitrary text with a brief check feedback. */ export function CopyTextButton({ ariaLabel, className, text, }: { ariaLabel: string; className?: string; text: string; }) { const [copied, setCopied] = React.useState(false); const handleCopy = React.useCallback( (event: React.MouseEvent) => { event.stopPropagation(); void writeTextToClipboard(text).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2_000); }); }, [text], ); return ( ); } /** Icon button that copies a full commit hash with a brief check feedback. */ export function CopyCommitHashButton({ className, hash, }: { className?: string; hash: string; }) { return ( ); }