"use client" import { useEffect, useState } from "react" import { Mail } from "lucide-react" interface MailToLinkProps { /** When provided (e.g. from Drupal field_email), use this email. Otherwise use fallback. */ email?: string | null } /** * Mailto link with icon; email is set on client to reduce harvestability when not passed as prop. */ export function MailToLink({ email }: MailToLinkProps) { const [href, setHref] = useState(email ? `mailto:${email}` : null) useEffect(() => { if (email) { setHref(`mailto:${email}`) return } const localPart = "robert" const domain = "nasarek" const tld = "dev" setHref(`mailto:${localPart}@${domain}.${tld}`) }, [email]) if (!href) { return ( Write me ) } return ( Write me ) }