mailto not working
This commit is contained in:
@@ -38,6 +38,7 @@ export default function HomePage() {
|
||||
// soft glow that follows the cursor in the background.
|
||||
// ---------------------------------------------------------------------------
|
||||
const [pointer, setPointer] = useState<PointerState>({ x: 50, y: 22 });
|
||||
const [copiedEmail, setCopiedEmail] = useState(false);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// BACKGROUND POSITION
|
||||
@@ -54,6 +55,16 @@ export default function HomePage() {
|
||||
[pointer.x, pointer.y]
|
||||
);
|
||||
|
||||
async function copyContactEmail() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(site.contact.email);
|
||||
setCopiedEmail(true);
|
||||
window.setTimeout(() => setCopiedEmail(false), 1800);
|
||||
} catch {
|
||||
setCopiedEmail(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<main
|
||||
id="top"
|
||||
@@ -369,6 +380,13 @@ export default function HomePage() {
|
||||
→
|
||||
</span>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onClick={copyContactEmail}
|
||||
className="inline-flex h-12 items-center rounded-xl border border-[var(--border-strong)] bg-[var(--surface)] px-5 text-sm font-semibold text-[var(--text)] backdrop-blur transition-all hover:-translate-y-0.5 hover:border-[var(--accent)] hover:text-[var(--accent)]"
|
||||
>
|
||||
{copiedEmail ? "Copied" : "Copy email"}
|
||||
</button>
|
||||
<span className="text-sm text-[var(--text-soft)]">
|
||||
{site.contact.note}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user