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>
4.4 KiB
4.4 KiB
Code Summary — Unit 3: Prijzen
Plan: prijzen-code-generation-plan.md. Functional design: ../functional-design/. Branch: feature/homepage-sections.
Files
Created
| File | Purpose |
|---|---|
web/src/assets/home/deco-1.png, deco-2.png |
Design decorations, unchanged (15 KB, 42 KB) |
web/src/content/packages.ts |
The three live packages (Zwangerschap 175, Newborn 185, Gezin 175) |
web/src/lib/formatPrice.ts + test |
€ 175 with a non-breaking space (BR-PRICE-01) |
web/src/lib/visiblePackages.ts + test |
isValidPackage + filter with first-wins de-duplication (BR-PRICE-02) |
web/src/lib/bookLabel.ts + test |
"Boek " up to 14 characters, else "Boek je shoot" + hidden name (BR-BOOK-02) |
web/src/lib/packageFromSearch.ts + test |
?pakket= → known id or undefined (BR-PARAM-01) |
web/src/components/home/Pricing/Pricing.tsx + test |
The section: decorations, heading, card grid |
web/src/components/home/Pricing/PriceCard.tsx + test |
One package card with the booking link |
Modified
| File | Change |
|---|---|
web/src/content/types.ts |
PricingPackage; HomeContent.pricing |
web/src/content/homeContent.ts |
Pricing title, lead, decorations |
web/src/recipes/linkButton.ts |
size: 'fit' — no wrapping, smaller side padding on phones (BR-BOOK-03); default unchanged |
web/src/theme.ts |
lift for the card hover |
web/src/test/arbitraries.ts |
pricingPackage, uniquePackages, anyPackage |
web/src/routes/index.tsx |
validateSearch keeps pakket only as a string; renders Pricing after AboutBlock |
web/src/app.test.tsx |
"Prijzen" in the page order; ?pakket=newborn, ?pakket=123 and ?pakket=<script> render without errors and without reflecting the value |
Notes and deviations
- Typed link: the shared
RouterLink(chakra(Link)) drops TanStack Router's route generics, sosearch={{ pakket }}would not type-check. The card uses the router's ownLinkwith thelinkButtonrecipe applied via Chakra'sasChild, so the search parameter is checked against the homepage route. - Second decoration: the design positions it relative to the whole section; in the content box the last card covered it, so it was moved into the section's bottom padding (found in the visual check).
- Literal special spaces: an editing tool turned
/escapes into the characters themselves, which ESLint rejects (no-irregular-whitespace); they were written back as escapes andsrcwas scanned for others.
Change request after testing on test (2026-10-20)
The owner removed the hover effect from the cards (lift, accent border, shadow); only the booking button keeps its effects. Removed in PriceCard.tsx, the lift shadow token in theme.ts, the static design (.price-card:hover) and the functional design.
Later change (unit 5)
The feature list is a plain ul/li instead of Chakra's List: its slot recipe pulled a shared chunk into the route bundle on page load (see the unit 5 code summary, performance).
Property-based tests (PBT)
| Function | Properties |
|---|---|
formatPrice |
digit round-trip; starts with € + NBSP, no breaking space |
visiblePackages |
only valid + unique ids; subsequence; idempotent; oracle on valid unique input |
bookLabel |
name always in the full text; visible form follows the 14-character rule |
packageFromSearch |
result undefined or a given id; any case/whitespace oracle; non-strings undefined; idempotent |
Verification (pnpm check)
- Lint ✅, Prettier ✅, build ✅
- Tests: 38 files, 170 passed; 100% coverage on the new
lib/files (threshold) - Lighthouse home: mobile 0.83–0.89 across runs (LCP 2.3–3.9 s), desktop 1.0; accessibility, best practices, SEO 1.0
- Visual check (CDP): 1440 three cards with decorations; 390 and 320 one column; "Boek Zwangerschap" stays on one line at 320 px
Extension compliance
- Security Baseline:
pakketnever reflected (tested with a script-like value); only known ids come out; no new dependencies or external resources. Other rules N/A. - PBT: PBT-02/03/04/05 covered per the table, PBT-07 domain generators, PBT-08/09 existing setup, PBT-10 example tests alongside; PBT-06 N/A (no stateful component).