import type { ReactNode } from 'react'; import { Box, chakra, Link, Text, useRecipe } from '@chakra-ui/react'; import Eyebrow from '@/components/Eyebrow/Eyebrow'; import PrivacyNote from '@/components/PrivacyNote/PrivacyNote'; import type { EmailAddress } from '@/content/types'; import { emailAddress } from '@/lib/emailAddress'; import { mailtoLink } from '@/lib/mailLink'; type ContactFormGateProps = { enabled: boolean; email: EmailAddress; subject: string; children: ReactNode; }; // Until there is a back-end the form stays visible but dimmed and inert // under a "coming soon" notice with a mail button (FR-HP-07). inert keeps // keyboard and screen reader users out of a form that does nothing. export default function ContactFormGate({ enabled, email, subject, children, }: ContactFormGateProps) { const linkButton = useRecipe({ key: 'linkButton' }); if (enabled) return <>{children}; // Assembled in the browser, so the address is nowhere in the bundle const address = emailAddress(email); const href = address ? mailtoLink(address, subject) : undefined; return ( {children} Binnenkort Het contactformulier komt binnenkort. {address && ( <> {' Mail me voor nu op '} {address} )} {address && ( Stuur een e-mail )} {/* Readable now, while the form's own line is inert (BR-PR-03) */} ); }