Adds the Contact section to the homepage

Adds the contact form with the live fields, validation and browser-side
anti-spam, behind a coming-soon notice with a mail button until the API
exists. A "Boek" link on a price card selects its package, tidies the
URL and moves focus to the form. The form loads only when it comes near
the screen, so the hero does not wait for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 00:36:43 +02:00
co-authored by Claude Opus 5.5
parent 0b8e8d5f8b
commit 0fce403ebc
46 changed files with 2505 additions and 16 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, it } from 'vitest';
import { submitContactForm } from './submitContactForm';
describe('submitContactForm', () => {
it('fails until the API exists', async () => {
await expect(
submitContactForm({
naam: 'Demi',
email: 'demi@example.nl',
shoot: 'newborn',
bericht: 'Hoi!',
}),
).rejects.toThrow('not available');
});
});
+21
View File
@@ -0,0 +1,21 @@
import type { ContactPayload } from './types';
// The one place where the contact form is sent. There is no back-end yet, so
// this always fails; the form is switched off (siteContent.contactForm) until
// it works. In the API feature this becomes:
//
// const response = await fetch('/api/contact', {
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({ ...payload, captcha: token }),
// });
// if (!response.ok) throw new Error(`Contact form: ${response.status}`);
//
// plus the Friendly Captcha token and the CSP entries it needs (FR-HP-09).
// Visitors never see this error's text, only the generic failure message.
export async function submitContactForm(
payload: ContactPayload,
): Promise<void> {
void payload;
throw new Error('Contact form is not available yet');
}
+32
View File
@@ -0,0 +1,32 @@
// What the contact form works with. The payload is what POST /api/contact
// will receive (plus the robot-check token, added in the API feature).
export type ContactField = 'naam' | 'email' | 'shoot' | 'bericht';
// What the visitor typed
export type ContactValues = Record<ContactField, string>;
// At most one message per field
export type ContactErrors = Partial<Record<ContactField, string>>;
// Trimmed values; shoot is a package id or 'overig'
export type ContactPayload = Record<ContactField, string>;
export interface ShootOption {
value: string;
label: string;
}
// Maximum lengths; also set as maxLength on the fields (BR-FORM-06)
export const CONTACT_LIMITS = {
naam: 100,
email: 254,
bericht: 2000,
} as const;
export const EMPTY_CONTACT: ContactValues = {
naam: '',
email: '',
shoot: '',
bericht: '',
};