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
+73
View File
@@ -1,4 +1,6 @@
import fc from 'fast-check';
import type { ContactField, ContactValues } from '../contact/types';
import type { ContactFormEvent } from '../lib/contactFormReducer';
import type {
EmailAddress,
PricingPackage,
@@ -138,3 +140,74 @@ export const anyTestimonial: fc.Arbitrary<Testimonial> = fc.oneof(
}),
}),
);
// Shoot values as the form offers them for the live packages
const shootValue = fc.constantFrom(
'zwangerschap',
'newborn',
'gezin',
'overig',
);
// Values that pass every rule: realistic text within the limits
export const contactValues: fc.Arbitrary<ContactValues> = fc.record({
naam: nonBlank,
email: validEmail.map(({ user, domain }) => `${user}@${domain}`),
shoot: shootValue,
bericht: fc
.string({ minLength: 1, maxLength: 300 })
.filter((text) => text.trim() !== ''),
});
// Valid and broken values mixed: empty, whitespace, too long, bad e-mail
export const anyContactValues: fc.Arbitrary<ContactValues> = fc.oneof(
contactValues,
fc.record({
naam: fc.oneof(nonBlank, fc.constantFrom('', ' ', 'x'.repeat(101))),
email: fc.oneof(
validEmail.map(({ user, domain }) => `${user}@${domain}`),
fc.constantFrom(
'',
'geen-adres',
'a@b',
'a b@c.nl',
'x'.repeat(255),
),
fc.string({ maxLength: 20 }),
),
shoot: fc.oneof(shootValue, fc.constantFrom('', 'bruiloft')),
bericht: fc.oneof(
nonBlank,
fc.constantFrom('', ' ', 'x'.repeat(2001)),
),
}),
);
const contactField = fc.constantFrom<ContactField>(
'naam',
'email',
'shoot',
'bericht',
);
// Anything that can happen to the form, for the state machine test
export const contactEvent: fc.Arbitrary<ContactFormEvent> = fc.oneof(
fc.record({
type: fc.constant('edit' as const),
field: contactField,
value: fc.oneof(
nonBlank,
fc.constantFrom('', 'a@b.nl', 'newborn', 'overig'),
),
}),
fc.record({ type: fc.constant('blur' as const), field: contactField }),
fc.record({ type: fc.constant('preselect' as const), shoot: shootValue }),
fc.record({
type: fc.constant('submit' as const),
honeypot: fc.constantFrom('', '', '', 'http://spam.example'),
shownAt: fc.constant(0),
now: fc.constantFrom(500, 5000, 10000),
}),
fc.constant({ type: 'resolved' as const }),
fc.constant({ type: 'rejected' as const }),
);