import { useState } from "react"; import { Copy, Check } from "lucide-react"; interface CopyableFieldProps { value: string; label: string; variant?: "input" | "inline"; } export function CopyableField({ value, label, variant = "input" }: CopyableFieldProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { try { await navigator.clipboard.writeText(value); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch (err) { console.error("Failed to copy:", err); } }; if (variant === "inline") { return (
{label}: {value}
); } return (
{value}
); }