"use client"; import { useState } from "react"; export function CopyEmail({ email, copyLabel, copiedLabel, }: { email: string; copyLabel: string; copiedLabel: string; }) { const [copied, setCopied] = useState(false); async function copy() { try { await navigator.clipboard.writeText(email); } catch { const area = document.createElement("textarea"); area.value = email; document.body.appendChild(area); area.select(); document.execCommand("copy"); document.body.removeChild(area); } setCopied(true); window.setTimeout(() => setCopied(false), 2000); } return ( ); }