Adds the inception docs and design for the homepage sections
Refreshes the shared reverse engineering docs, adds the requirements, application design and units for the homepage-sections feature, and updates the static design: live prices and form fields, the new Lieve woorden block and the coming-soon gate over the contact form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
# Application Design — homepage-sections
|
||||
|
||||
Consolidated design. Details: [components.md](components.md), [component-methods.md](component-methods.md), [services.md](services.md), [component-dependency.md](component-dependency.md). Decisions: [application-design-plan.md](../plans/application-design-plan.md) (Q1–Q6 all A, except Q1 = B).
|
||||
|
||||
## 1. Design reference (FR-HP-01, done in this stage)
|
||||
- `design/andreaslop-static/index.html` + `assets/css/style.css` + `assets/js/main.js`:
|
||||
- Prijzen: live packages (Zwangerschap € 175, Newborn € 185, Gezin € 175 with the live inclusions); "Boek je shoot" → `index.html?pakket=<id>#contact`, preselected by the script
|
||||
- **Lieve woorden** (new, section 13b in the CSS): between Prijzen and Contact on `paper.alt`; one review at a time — framed photo (same sand offset block as the about block), large Marcellus quotation mark in heidegroen, shoot type as eyebrow, quote in Marcellus, names in small caps; prev/next arrows and dots (44 px hit areas); polite live region; no autoplay; stacked below 1024 px
|
||||
- Contact: live fields (Naam, E-mail, "In welke shoot heb je interesse?" select, "Stel hier je vraag"), button "(Aan)vraag versturen", honeypot, time check; the form sits dimmed and `inert` under a "Binnenkort" notice with "Stuur een e-mail" (`data-form-disabled` switch); now on a plain `paper` background so backgrounds keep alternating
|
||||
- Lifestyle fotografie: `intro-3.jpg` replaced by the current live photo (manifest updated)
|
||||
- `LAYOUT.md`: Home now has seven blocks (Hero, Highlights, About me, Prices, **Testimonials**, Contact, Instagram); new letter G colour added to `.ai/layout-conventions.md`.
|
||||
- `contact.html` (the `/contact` page design) is unchanged — out of scope (Q16); the script supports both forms.
|
||||
|
||||
## 2. Structure
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
Route["routes/index.tsx (validateSearch pakket)"] --> Hero["Hero (exists)"]
|
||||
Route --> S1["home/IntroGallery"]
|
||||
Route --> S2["home/AboutBlock"]
|
||||
Route --> S3["home/Pricing"]
|
||||
Route --> S4["home/Testimonials"]
|
||||
Route --> S5["home/ContactSection"]
|
||||
Route --> S6["home/InstagramGrid"]
|
||||
S5 --> Gate["ContactForm/ContactFormGate"]
|
||||
Gate --> Form["ContactForm/ContactForm"]
|
||||
Form --> Adapter["contact/submitContactForm"]
|
||||
classDef route fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||
classDef home fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef shared fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||
class Route route;
|
||||
class S1,S2,S3,S4,S5,S6 home;
|
||||
class Gate,Form,Adapter shared;
|
||||
class Hero existing;
|
||||
```
|
||||
|
||||
Text alternative: the home route renders the Hero and six home sections in page order; the contact section wraps the reusable form in a gate, and the form submits through a single adapter.
|
||||
|
||||
- **Folders** (Q1 = B): `components/home/{IntroGallery,AboutBlock,Pricing,Testimonials,ContactSection,InstagramGrid}`; reusable pieces in `components/{HomeSection,SectionHeading,Reveal,FramedImage,ContactForm}`; `hooks/useReveal.ts`; `contact/{types,submitContactForm}.ts`.
|
||||
- **Shared building blocks**: `HomeSection` (padding, tone, width, `aria-labelledby`, anchor), `SectionHeading` (eyebrow, h2, lead), `Reveal` (+ `useReveal`), `FramedImage` (photo + sand offset block).
|
||||
|
||||
## 3. Content (Q2 = A)
|
||||
- `content/packages.ts` (`PricingPackage[]`), `content/testimonials.ts` (`Testimonial[]`), `content/homeContent.ts` (`HomeContent`: section texts, gallery, about, instagram), `siteContent.contactForm.enabled = false` (Q5 = A).
|
||||
- Images as `ContentImage { src, alt, width, height }` from `web/src/assets`.
|
||||
- Only the route imports content; components get props.
|
||||
|
||||
## 4. Key interactions
|
||||
- **Testimonials** (Q3 = A): Chakra `Carousel` (Ark UI) — keyboard, swipe, indicators and slide semantics built in; no autoplay; custom styling; live-region text from `slideLabel`; controls hidden for a single review.
|
||||
- **Prijzen → Contact** (Q4 = A): `/?pakket=<id>#contact`; `packageFromSearch` ignores unknown ids; preselected value flows into the form as `initialShoot`.
|
||||
- **Contact form**: Chakra `Field`/`Input`/`Textarea`/`NativeSelect`; plain React state; `validateContact` → per-field errors, focus to the first invalid field; `isLikelySpam` (honeypot + time check) → silent success; `submitContactForm` adapter (today rejects generically).
|
||||
- **Gate**: `ContactFormGate` with `enabled` from `siteContent.contactForm`; when off, the form is dimmed and `inert`, the notice shows the e-mail address (assembled with the existing `emailAddress`) and a mailto button; without a valid address only the coming-soon text.
|
||||
- **Instagram**: profile URL derived from `siteContent.socials` via `visibleSocials`; section hidden without one.
|
||||
|
||||
## 5. Pure helpers (`lib/`, PBT candidates)
|
||||
`formatPrice`, `shootOptions`, `packageFromSearch`, `validateContact`, `toContactPayload`, `isLikelySpam`, `slideLabel`. Property identification per unit in Functional Design (PBT-01).
|
||||
|
||||
## 6. Requirements coverage
|
||||
| Requirement | Covered by |
|
||||
|---|---|
|
||||
| FR-HP-01 | §1 (done) |
|
||||
| FR-HP-02 | IntroGallery |
|
||||
| FR-HP-03 | AboutBlock, FramedImage |
|
||||
| FR-HP-04 | Pricing, PriceCard, packages.ts, formatPrice, package handover |
|
||||
| FR-HP-05 | Testimonials (Chakra Carousel), testimonials.ts, slideLabel |
|
||||
| FR-HP-06 | ContactSection, ContactForm, validateContact, shootOptions, submitContactForm |
|
||||
| FR-HP-07 | ContactFormGate, siteContent.contactForm |
|
||||
| FR-HP-08 | isLikelySpam, honeypot field, max lengths |
|
||||
| FR-HP-09 | Widget slot in ContactForm (no script); integration in the API feature |
|
||||
| FR-HP-10 | InstagramGrid, homeContent.instagram |
|
||||
| FR-HP-11 | Reveal, useReveal |
|
||||
| FR-HP-12 | content modules, ContentImage, assets |
|
||||
| NFR-HP-01 | HomeSection labelling, Field wiring, Carousel semantics, inert gate, 44 px targets |
|
||||
| NFR-HP-02 | Shared blocks, Chakra built-ins, theme reuse, English comments |
|
||||
| NFR-HP-03 | Injectable submit, pure helpers, arbitraries |
|
||||
| NFR-HP-04 | No new third parties, adapter + gate, spam filter, generic errors |
|
||||
| NFR-HP-05 | Lazy images with dimensions |
|
||||
| NFR-HP-06 | API-shaped content and payload types |
|
||||
|
||||
## 7. Extension compliance (Application Design)
|
||||
- **Security Baseline**: SECURITY-04 compliant (no CSP change, no external resources); SECURITY-05 compliant at design level (client-side validation designed, server-side assigned to the API feature); SECURITY-10 compliant (no new dependencies — Chakra Carousel is part of the installed `@chakra-ui/react`); SECURITY-11 compliant (submission isolated in one adapter; misuse case: form spam — gate, honeypot, time check; captcha and rate limiting assigned to the API feature); SECURITY-13 compliant (no CDN resources); SECURITY-15 compliant (adapter failure → generic message, input kept). SECURITY-01/02/03/06/07/08/09/12/14 N/A (no server, data store, IAM or authentication in this feature).
|
||||
- **Property-Based Testing**: PBT-01 planned per unit in Functional Design; pure helpers are isolated in `lib/` to make them property-testable; PBT-07 generators to be added to `test/arbitraries.ts`; PBT-08/09 compliant (existing fast-check setup with seed logging).
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
# Component Dependencies — homepage-sections
|
||||
|
||||
## Dependency matrix
|
||||
|
||||
Rows depend on columns (✓).
|
||||
|
||||
| Component | HomeSection | SectionHeading | Reveal | FramedImage | LinkButton | ContactForm(+Gate) | lib/ helpers | content types | Chakra built-ins |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| IntroGallery | ✓ | ✓ | ✓ | | | | | ✓ | Grid, Image |
|
||||
| AboutBlock | ✓ | ✓ | ✓ | ✓ | | | | ✓ | Grid, Text, Link |
|
||||
| Pricing / PriceCard | ✓ | ✓ | ✓ | | ✓ | | formatPrice | ✓ | SimpleGrid, List |
|
||||
| Testimonials | ✓ | ✓ | ✓ | ✓ | | | slideLabel | ✓ | Carousel, Blockquote |
|
||||
| ContactSection | ✓ | ✓ | ✓ | | | ✓ | shootOptions | ✓ | — |
|
||||
| ContactForm | | | | | linkButton recipe | | validateContact, toContactPayload, isLikelySpam | ✓ | Field, Input, Textarea, NativeSelect |
|
||||
| ContactFormGate | | | | | ✓ (mail button) | | emailAddress (exists) | ✓ | — |
|
||||
| InstagramGrid | ✓ | ✓ | ✓ | | | | | ✓ | Grid, Link, VisuallyHidden |
|
||||
| routes/index.tsx | | | | | | | packageFromSearch, visibleSocials (exists) | content modules | — |
|
||||
|
||||
No section depends on another section; the only cross-section link (Prijzen → Contact) goes through the URL.
|
||||
|
||||
## Data flow
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
Content["content/ homeContent, packages, testimonials, siteContent"] --> Route["routes/index.tsx"]
|
||||
URL["URL search pakket"] --> Route
|
||||
Route -->|"props"| Sections["Six home sections"]
|
||||
Route -->|"preselected id"| Contact["ContactSection / ContactForm"]
|
||||
Sections -->|"Link with pakket + #contact"| URL
|
||||
Contact -->|"ContactPayload"| Adapter["submitContactForm"]
|
||||
Adapter -.->|"later"| API["POST /api/contact"]
|
||||
classDef data fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef comp fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
classDef ext fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,stroke-dasharray:5 5,color:#000;
|
||||
class Content,URL data;
|
||||
class Route,Sections,Contact,Adapter comp;
|
||||
class API ext;
|
||||
```
|
||||
|
||||
Text alternative: static content and the URL's pakket parameter flow into the home route, which passes props to the sections and the preselected package to the contact form; price cards write the package back into the URL; the form sends its payload through the single adapter, which will call the API later.
|
||||
|
||||
## Communication patterns
|
||||
- **Props down** from the route; no context or global store.
|
||||
- **URL as the shared channel** between Prijzen and Contact.
|
||||
- **Callback-free sections**: sections emit nothing upward.
|
||||
- **Injectable submit** on ContactForm for tests; default is the real adapter.
|
||||
|
||||
## Coupling notes
|
||||
- `ContactForm` depends on `ShootOption[]`, not on `PricingPackage`, so the `/contact` page can reuse it with the same options.
|
||||
- `InstagramGrid` receives `profileUrl` from the route (derived from `siteContent.socials` via `visibleSocials`), so the Instagram URL has one source.
|
||||
- `FramedImage` is the only new shared visual primitive; anything else reuses theme tokens, text styles and recipes.
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
# Component Methods — homepage-sections
|
||||
|
||||
Signatures and data shapes. Detailed rules (validation messages, limits, carousel behaviour, spam thresholds) follow in Functional Design per unit.
|
||||
|
||||
## Content types (`content/types.ts`, additions)
|
||||
|
||||
```ts
|
||||
// An image as the API will deliver it; src is a URL (bundled asset today)
|
||||
interface ContentImage {
|
||||
src: string;
|
||||
alt: string;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface PricingPackage {
|
||||
id: string; // stable slug, e.g. 'newborn'; used in ?pakket= and as the shoot value
|
||||
name: string; // 'Newborn'
|
||||
price: number; // whole euros, e.g. 185
|
||||
features: string[]; // '1-2 uur fotografie', ...
|
||||
}
|
||||
|
||||
interface Testimonial {
|
||||
id: string;
|
||||
shoot: string; // label, e.g. 'Newbornshoot'
|
||||
quote: string;
|
||||
author: string; // 'Demi & Kevin'
|
||||
image: ContentImage;
|
||||
}
|
||||
|
||||
interface HomeContent {
|
||||
intro: { title: string; lead: string; photos: ContentImage[] };
|
||||
about: {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
paragraphs: string[];
|
||||
image: ContentImage;
|
||||
link: { label: string; to: RoutePath };
|
||||
};
|
||||
pricing: { title: string; lead: string };
|
||||
testimonials: { title: string };
|
||||
contact: { title: string; lead: string };
|
||||
instagram: { title: string; handle: string; photos: ContentImage[] };
|
||||
}
|
||||
|
||||
// SiteContent gains:
|
||||
interface SiteContent {
|
||||
// ...existing fields
|
||||
contactForm: { enabled: boolean };
|
||||
}
|
||||
```
|
||||
|
||||
Content modules (design Q2 = A): `content/packages.ts` → `PricingPackage[]`, `content/testimonials.ts` → `Testimonial[]`, `content/homeContent.ts` → `HomeContent`.
|
||||
|
||||
## Contact types (`contact/types.ts`)
|
||||
|
||||
```ts
|
||||
interface ContactValues { // what the visitor typed
|
||||
naam: string;
|
||||
email: string;
|
||||
shoot: string; // '' | a package id | 'overig'
|
||||
bericht: string;
|
||||
}
|
||||
|
||||
type ContactField = keyof ContactValues;
|
||||
type ContactErrors = Partial<Record<ContactField, string>>;
|
||||
|
||||
interface ContactPayload { // what goes to POST /api/contact
|
||||
naam: string;
|
||||
email: string;
|
||||
shoot: string;
|
||||
bericht: string;
|
||||
}
|
||||
|
||||
interface ShootOption { value: string; label: string }
|
||||
```
|
||||
|
||||
## Components (props)
|
||||
|
||||
| Component | Props |
|
||||
|---|---|
|
||||
| `HomeSection` | `{ labelledBy: string; id?: string; tone?: 'paper' \| 'alt'; width?: 'default' \| 'narrow'; spacing?: 'default' \| 'tight'; children: ReactNode }` |
|
||||
| `SectionHeading` | `{ id: string; title: string; eyebrow?: string; lead?: string; align?: 'center' \| 'start' }` |
|
||||
| `Reveal` | `{ children: ReactNode; delay?: number }` |
|
||||
| `FramedImage` | `{ image: ContentImage; aspectRatio: string }` |
|
||||
| `IntroGallery` | `{ content: HomeContent['intro'] }` |
|
||||
| `AboutBlock` | `{ content: HomeContent['about'] }` |
|
||||
| `Pricing` | `{ content: HomeContent['pricing']; packages: PricingPackage[] }` |
|
||||
| `PriceCard` | `{ pkg: PricingPackage }` |
|
||||
| `Testimonials` | `{ content: HomeContent['testimonials']; testimonials: Testimonial[] }` |
|
||||
| `ContactSection` | `{ content: HomeContent['contact']; packages: PricingPackage[]; enabled: boolean; email: EmailAddress; preselected?: string }` |
|
||||
| `ContactFormGate` | `{ enabled: boolean; email: EmailAddress; children: ReactNode }` |
|
||||
| `ContactForm` | `{ idPrefix: string; options: ShootOption[]; initialShoot?: string; submit?: (payload: ContactPayload) => Promise<void> }` (`submit` defaults to `submitContactForm`; injectable for tests) |
|
||||
| `InstagramGrid` | `{ content: HomeContent['instagram']; profileUrl: string }` |
|
||||
|
||||
## Hooks
|
||||
|
||||
- `useReveal<T extends Element>(): { ref: RefObject<T>; visible: boolean }` — `visible` starts `true` when reduced motion is on or IntersectionObserver is missing; otherwise flips to `true` once and stops observing.
|
||||
|
||||
## Pure helpers (`lib/`, 100% coverage, property-based tests)
|
||||
|
||||
| Function | Purpose |
|
||||
|---|---|
|
||||
| `formatPrice(euros: number): string` | `185` → `'€ 185'` (nl-NL, no decimals) |
|
||||
| `shootOptions(packages: PricingPackage[]): ShootOption[]` | package names in order + `{ value: 'overig', label: 'Overig' }` |
|
||||
| `packageFromSearch(value: unknown, packages: PricingPackage[]): string \| undefined` | returns the id only if it matches a package |
|
||||
| `validateContact(values: ContactValues, options: ShootOption[]): ContactErrors` | required fields, e-mail format, max lengths, shoot must be a known option |
|
||||
| `toContactPayload(values: ContactValues): ContactPayload` | trims fields |
|
||||
| `isLikelySpam(input: { honeypot: string; shownAt: number; now: number }): boolean` | honeypot filled or submitted too fast |
|
||||
| `slideLabel(index: number, count: number): string` | `'Review 2 van 3'` for the live region and slide `aria-label` |
|
||||
|
||||
## Services / adapters
|
||||
|
||||
- `submitContactForm(payload: ContactPayload): Promise<void>` (`contact/submitContactForm.ts`) — today rejects with a generic error (no back-end); later `POST /api/contact`.
|
||||
- Route search: `validateSearch: (search) => ({ pakket: typeof search.pakket === 'string' ? search.pakket : undefined })` on `/`; the page then resolves it with `packageFromSearch`.
|
||||
@@ -0,0 +1,86 @@
|
||||
# Components — homepage-sections
|
||||
|
||||
Folder structure per design Q1 = B: the six homepage blocks live under `components/home/`; anything reusable elsewhere stays directly under `components/`.
|
||||
|
||||
## Overview
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
Route["routes/index.tsx"] --> Hero["Hero (exists)"]
|
||||
Route --> Intro["home/IntroGallery"]
|
||||
Route --> About["home/AboutBlock"]
|
||||
Route --> Pricing["home/Pricing"]
|
||||
Route --> Testimonials["home/Testimonials"]
|
||||
Route --> ContactSection["home/ContactSection"]
|
||||
Route --> Instagram["home/InstagramGrid"]
|
||||
Pricing --> PriceCard["home/Pricing/PriceCard"]
|
||||
ContactSection --> Gate["ContactForm/ContactFormGate"]
|
||||
Gate --> Form["ContactForm/ContactForm"]
|
||||
About --> Framed["FramedImage"]
|
||||
Testimonials --> Framed
|
||||
Intro --> Shared["HomeSection + SectionHeading + Reveal"]
|
||||
About --> Shared
|
||||
Pricing --> Shared
|
||||
Testimonials --> Shared
|
||||
ContactSection --> Shared
|
||||
Instagram --> Shared
|
||||
classDef route fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||
classDef home fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef shared fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
classDef existing fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||
class Route route;
|
||||
class Intro,About,Pricing,PriceCard,Testimonials,ContactSection,Instagram home;
|
||||
class Gate,Form,Framed,Shared shared;
|
||||
class Hero existing;
|
||||
```
|
||||
|
||||
Text alternative: the home route renders the existing Hero and six new home sections; Pricing uses PriceCard, ContactSection wraps the reusable ContactForm in a ContactFormGate, AboutBlock and Testimonials share FramedImage, and every section uses HomeSection, SectionHeading and Reveal.
|
||||
|
||||
## Shared components (`components/`)
|
||||
|
||||
### HomeSection
|
||||
- **Purpose**: the design's `.section` wrapper for a content block
|
||||
- **Responsibilities**: vertical padding (`section-y`), optional `paper.alt` background (`tone`), optional tight padding, `Container` width (default or narrow), `aria-labelledby` pointing at its heading, optional `id` (anchor)
|
||||
- **Interface**: `<HomeSection labelledBy tone? width? spacing? id?>children</HomeSection>`
|
||||
|
||||
### SectionHeading
|
||||
- **Purpose**: the design's `.section__head`
|
||||
- **Responsibilities**: optional eyebrow (`eyebrow` text style, `accent.deep`), the h2 (with `id` for `aria-labelledby`), optional lead (`ink.soft`); centred or start-aligned
|
||||
- **Interface**: `<SectionHeading id title eyebrow? lead? align?>`
|
||||
|
||||
### Reveal
|
||||
- **Purpose**: the design's `.reveal` fade-in on scroll
|
||||
- **Responsibilities**: wraps children; hidden-then-visible transition once the element enters the viewport; immediately visible under reduced motion, without IntersectionObserver, or before JavaScript runs (no content hidden by default in markup)
|
||||
- **Interface**: `<Reveal delay?>children</Reveal>`; logic in `hooks/useReveal.ts`
|
||||
|
||||
### FramedImage
|
||||
- **Purpose**: the photo with the sand offset block behind it (`.about__media`), shared by AboutBlock and Testimonials (design Q6 = A)
|
||||
- **Responsibilities**: image with fixed aspect ratio, `loading="lazy"`, explicit width/height; decorative offset block hidden below `sm`
|
||||
- **Interface**: `<FramedImage image aspectRatio>`
|
||||
|
||||
### ContactForm (`components/ContactForm/`)
|
||||
- **ContactForm** — the form itself: fields Naam, E-mail, shoot select, Bericht; honeypot; per-field errors via Chakra `Field`; submit button; status message. Owns its form state. Reusable on `/contact` later.
|
||||
- **ContactFormGate** — wraps ContactForm; when `enabled` is false the form is dimmed and `inert` and the coming-soon notice with the mail button is shown over it; when true the form is shown as is.
|
||||
- **submitContactForm** (`src/contact/submitContactForm.ts`) — the single submission adapter (see services.md).
|
||||
|
||||
## Homepage sections (`components/home/`)
|
||||
|
||||
| Component | Unit | Purpose | Key responsibilities |
|
||||
|---|---|---|---|
|
||||
| `IntroGallery` | 1 Lifestyle fotografie | Heading + four-photo gallery | Staggered 4-column grid (2 on tablet, 1 on mobile), hover zoom, alt texts |
|
||||
| `AboutBlock` | 2 Over mij | Photo + intro text | FramedImage, eyebrow, h2, paragraphs, "Lees mijn verhaal" link to `/over-mij`, `paper.alt` |
|
||||
| `Pricing` + `PriceCard` | 3 Prijzen | Package cards | Decorations, card grid (1 column below `lg`), price formatting, "Boek je shoot" link with `pakket` search param + `#contact` |
|
||||
| `Testimonials` | 4 Lieve woorden | One review at a time | Chakra `Carousel` (no autoplay), FramedImage, quotation mark, shoot label, `Blockquote`, author; prev/next + indicators; live-region status; no controls for a single review; `paper.alt` |
|
||||
| `ContactSection` | 5 Contact | Contact block | Heading + lead, `id="contact"`, ContactFormGate with ContactForm, passes the preselected package and the e-mail address |
|
||||
| `InstagramGrid` | 6 Instagram | Heading + photo grid | Handle link, six tiles (6/3/2 columns) linking to the profile, external link attributes; not rendered without a valid Instagram profile URL |
|
||||
|
||||
## Modified existing components / modules
|
||||
|
||||
| File | Change |
|
||||
|---|---|
|
||||
| `routes/index.tsx` | Renders the six sections after the Hero; `validateSearch` for `pakket` |
|
||||
| `content/types.ts` | New content interfaces (see component-methods.md) |
|
||||
| `content/siteContent.ts` | `contactForm: { enabled: false }` (design Q5 = A) |
|
||||
| `recipes/linkButton.ts` | Usable on a `<button>` (submit) — no new variant |
|
||||
| `theme.ts` | Possibly a `sectionY` spacing token and field styling (Functional Design / code plan decide) |
|
||||
| `test/arbitraries.ts` | Generators for packages, contact values, testimonials |
|
||||
@@ -0,0 +1,53 @@
|
||||
# Services — homepage-sections
|
||||
|
||||
The site has no back-end; "services" here are the front-end mechanisms that provide content, connect sections and will later talk to the API.
|
||||
|
||||
## 1. Content provisioning
|
||||
- **Responsibility**: deliver section content to the components.
|
||||
- **Today**: static modules `content/homeContent.ts`, `content/packages.ts`, `content/testimonials.ts` and the existing `content/siteContent.ts`, imported by `routes/index.tsx` and passed down as props. Images are imported from `web/src/assets` (Vite-hashed URLs, typed as `ContentImage`).
|
||||
- **Later**: the same shapes come from the .NET API (`/api/pages`, `/api/packages`, testimonials and the Instagram feed server-side) through a route loader; components do not change.
|
||||
- **Rule**: components never import content modules directly — only the route does. Keeps them testable with generated content.
|
||||
|
||||
## 2. Package handover (Prijzen → Contact)
|
||||
- **Responsibility**: "Boek je shoot" brings the visitor to the form with the package chosen (design Q4 = A).
|
||||
- **Flow**: `PriceCard` renders a router `Link` to `/` with `search={{ pakket: pkg.id }}` and `hash="contact"`. The `/` route's `validateSearch` keeps `pakket` as an optional string; the page resolves it with `packageFromSearch` against the package list (unknown values are ignored) and passes it to `ContactSection` → `ContactForm` as `initialShoot`. The router scrolls to `#contact`.
|
||||
- **Properties**: survives a reload, shareable, no shared mutable state between sections.
|
||||
|
||||
## 3. Contact submission adapter
|
||||
- **Responsibility**: the only place that sends a contact request.
|
||||
- **Today**: `submitContactForm` rejects with a generic error; with `contactForm.enabled = false` it is never reached because the form is inert.
|
||||
- **Later (API feature)**: `POST /api/contact` with `ContactPayload` plus the Friendly Captcha token; server-side validation, spam checks and rate limiting; CSP additions for Friendly Captcha.
|
||||
- **Switch**: `siteContent.contactForm.enabled` (design Q5 = A) — can be turned on and off again; later deliverable by the CMS.
|
||||
|
||||
## 4. Spam filtering (browser side)
|
||||
- **Responsibility**: drop obvious bot submissions before they reach the adapter.
|
||||
- **Flow**: on submit, after validation, `isLikelySpam({ honeypot, shownAt, now })`; spam gets the normal success message and nothing is sent.
|
||||
|
||||
## 5. Scroll reveal
|
||||
- **Responsibility**: fade sections in as they enter the viewport (`useReveal` + `Reveal`), disabled under reduced motion.
|
||||
|
||||
## Orchestration
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
box rgba(246,224,94,0.4) Visitor
|
||||
participant V as Visitor
|
||||
end
|
||||
box rgba(99,179,237,0.4) Homepage
|
||||
participant P as PriceCard
|
||||
participant R as Route /
|
||||
participant C as ContactForm
|
||||
participant A as submitContactForm
|
||||
end
|
||||
V->>P: Click Boek je shoot (Newborn)
|
||||
P->>R: Navigate to /?pakket=newborn#contact
|
||||
R->>R: packageFromSearch checks the id
|
||||
R->>C: initialShoot newborn, scroll to contact
|
||||
V->>C: Fill in and submit
|
||||
C->>C: validateContact, isLikelySpam
|
||||
C->>A: ContactPayload (only when enabled and not spam)
|
||||
A-->>C: Resolved or generic error
|
||||
C-->>V: Status message
|
||||
```
|
||||
|
||||
Text alternative: clicking "Boek je shoot" navigates to the homepage with the package in the URL; the route checks it and preselects it in the form; on submit the form validates and filters spam before calling the single submission adapter and showing a status message.
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# Unit Dependencies — homepage-sections
|
||||
|
||||
## Dependency matrix
|
||||
|
||||
Rows depend on columns (✓ = needs something that unit introduces).
|
||||
|
||||
| Unit | 1 Lifestyle | 2 Over mij | 3 Prijzen | 4 Lieve woorden | 5 Contact | 6 Instagram |
|
||||
|---|---|---|---|---|---|---|
|
||||
| 1 Lifestyle fotografie | — | | | | | |
|
||||
| 2 Over mij | ✓ HomeSection, SectionHeading, Reveal, ContentImage | — | | | | |
|
||||
| 3 Prijzen | ✓ | | — | | | |
|
||||
| 4 Lieve woorden | ✓ | ✓ FramedImage | | — | | |
|
||||
| 5 Contact | ✓ | | ✓ packages, packageFromSearch, `pakket` search | | — | |
|
||||
| 6 Instagram | ✓ | | | | | — |
|
||||
|
||||
## Order
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
U1["1 Lifestyle fotografie (shared blocks)"] --> U2["2 Over mij (FramedImage)"]
|
||||
U2 --> U3["3 Prijzen (packages)"]
|
||||
U3 --> U4["4 Lieve woorden"]
|
||||
U4 --> U5["5 Contact"]
|
||||
U5 --> U6["6 Instagram"]
|
||||
U6 --> BT["Build and Test + one PR"]
|
||||
U1 -.-> U3
|
||||
U1 -.-> U6
|
||||
U2 -.-> U4
|
||||
U3 -.-> U5
|
||||
classDef unit fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef shared fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
classDef final fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||
class U2,U4,U5,U6 unit;
|
||||
class U1,U3 shared;
|
||||
class BT final;
|
||||
```
|
||||
|
||||
Text alternative: the units run in page order 1 to 6, then Build and Test; dashed arrows show the real dependencies — unit 1's shared blocks are used by all, unit 2's FramedImage by unit 4, and unit 3's packages by unit 5.
|
||||
|
||||
## Notes
|
||||
- The build order equals the page order, so the homepage is always correct up to the last finished unit.
|
||||
- Units 4 and 6 could be swapped without impact; unit 5 must come after unit 3.
|
||||
- Integration points checked at Build and Test: section order in `routes/index.tsx`, background alternation, Prijzen → Contact preselection, full-page Lighthouse.
|
||||
- One branch, commits per unit, one PR at the end; no unit is merged to `master` on its own.
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
# Requirement-to-Unit Map — homepage-sections
|
||||
|
||||
User Stories were skipped (single visitor persona), so this maps every requirement from [requirements.md](../requirements/requirements.md) to the unit(s) that deliver it.
|
||||
|
||||
| Requirement | Unit(s) | Notes |
|
||||
|---|---|---|
|
||||
| FR-HP-01 Static design and LAYOUT.md | — | Done in Application Design |
|
||||
| FR-HP-02 Lifestyle fotografie | 1 | |
|
||||
| FR-HP-03 Over mij | 2 | |
|
||||
| FR-HP-04 Prijzen | 3 (cards, link) · 5 (preselection in the form) | |
|
||||
| FR-HP-05 Lieve woorden | 4 | |
|
||||
| FR-HP-06 Contact form | 5 | Shoot options from unit 3's packages |
|
||||
| FR-HP-07 Coming-soon overlay | 5 | |
|
||||
| FR-HP-08 Anti-spam (browser) | 5 | |
|
||||
| FR-HP-09 Robot check (slot only) | 5 | Integration in the future API feature |
|
||||
| FR-HP-10 Instagram | 6 | |
|
||||
| FR-HP-11 Scroll reveal | 1 (introduced) · 2–6 (used) | |
|
||||
| FR-HP-12 Content and images | 1–6 | Each unit adds its own content and images |
|
||||
| NFR-HP-01 Accessibility | 1–6 · Build and Test (Lighthouse full page) | Carousel (4) and form/gate (5) carry the most rules |
|
||||
| NFR-HP-02 Styling and consistency | 1–6 | Shared blocks in 1 and 2 |
|
||||
| NFR-HP-03 Testing | 1–6 · Build and Test | PBT for helpers in 3, 4, 5 |
|
||||
| NFR-HP-04 Security | 5 (form, adapter, spam) · 6 (external links) · all (no third parties) | |
|
||||
| NFR-HP-05 Performance | 1–6 (per-unit `pnpm check` incl. Lighthouse) · Build and Test | |
|
||||
| NFR-HP-06 API-shaped content | 1–6 | Payload type in 5 |
|
||||
|
||||
All requirements are assigned; none is left without a unit or stage.
|
||||
@@ -0,0 +1,65 @@
|
||||
# Units of Work — homepage-sections
|
||||
|
||||
Six units, one per homepage block (user request), built in order on one branch, `feature/homepage-sections`, and delivered in **one pull request** at the end (units Q1 = A). After each unit's Code Generation the full **`pnpm check`** runs, Lighthouse included (units Q2 = A). Each unit adds its section to `routes/index.tsx`, so the homepage is complete up to that unit and never broken in between.
|
||||
|
||||
All units are modules inside the single deployable `web/` SPA (no separate services).
|
||||
|
||||
## Common conventions (apply to every unit)
|
||||
- **Images**: downloaded from andreaslop.nl (source URLs in `design/andreaslop-static/assets/img/manifest.txt`), resized once to at most ±1600 px on the long side and compressed, stored in `web/src/assets/home/`, typed as `ContentImage` with real width/height, rendered with `loading="lazy"`. The resize tool is picked in unit 1's code plan; it must not become a project dependency.
|
||||
- **Tests**: example-based component test with axe per section; property-based tests for every new `lib/` helper (PBT extension, full); shared generators in `src/test/arbitraries.ts`.
|
||||
- **Code comments in English**; visitor-facing text in Dutch (NFR-HP-02).
|
||||
- **Design reference**: `design/andreaslop-static/index.html` + `style.css` (updated in Application Design).
|
||||
|
||||
---
|
||||
|
||||
## Unit 1 — Lifestyle fotografie
|
||||
- **Section**: `components/home/IntroGallery` — heading "Lifestyle fotografie", lead, four photos in the staggered grid (4 / 2 / 1 columns), hover zoom.
|
||||
- **Shared pieces introduced**: `components/HomeSection`, `components/SectionHeading`, `components/Reveal` + `hooks/useReveal.ts`.
|
||||
- **Content**: `ContentImage` and `HomeContent` (intro part, extended by later units) in `content/types.ts`; `content/homeContent.ts`.
|
||||
- **Images**: intro-1 … intro-4 (live photos).
|
||||
- **Functional Design**: skipped (presentational).
|
||||
- **Done when**: section renders below the hero with correct heading structure; reveal works and is off under reduced motion; `pnpm check` green.
|
||||
|
||||
## Unit 2 — Over mij
|
||||
- **Section**: `components/home/AboutBlock` — framed photo, eyebrow "Over mij", h2, three paragraphs, "Lees mijn verhaal" → `/over-mij`, on `paper.alt`.
|
||||
- **Shared pieces introduced**: `components/FramedImage` (sand offset block).
|
||||
- **Content**: `HomeContent.about`.
|
||||
- **Images**: andrea-home (live).
|
||||
- **Functional Design**: skipped (presentational).
|
||||
- **Done when**: section renders after Lifestyle fotografie; link works; offset block hidden on small screens; `pnpm check` green.
|
||||
|
||||
## Unit 3 — Prijzen
|
||||
- **Section**: `components/home/Pricing` + `PriceCard` — heading "Prijzen", lead "Pakketten", decorations, three cards, "Boek je shoot" → `/?pakket=<id>#contact`.
|
||||
- **Logic**: `lib/formatPrice`, `lib/packageFromSearch`; `validateSearch` for `pakket` on the `/` route.
|
||||
- **Content**: `PricingPackage` type, `content/packages.ts` (Zwangerschap, Newborn, Gezin), `HomeContent.pricing`.
|
||||
- **Images**: deco-1.png, deco-2.png (design decorations).
|
||||
- **Functional Design**: **executed** — package/price rules, search param handling, properties for PBT-01.
|
||||
- **Done when**: cards match the live content; the link carries the package; unknown `pakket` values are ignored; `pnpm check` green. (The preselection itself becomes visible in unit 5.)
|
||||
|
||||
## Unit 4 — Lieve woorden
|
||||
- **Section**: `components/home/Testimonials` — heading "Lieve woorden", Chakra `Carousel` without autoplay, FramedImage, quotation mark, shoot label, `Blockquote`, author; prev/next and indicators; live-region status; no controls for one review; on `paper.alt`.
|
||||
- **Logic**: `lib/slideLabel`.
|
||||
- **Content**: `Testimonial` type, `content/testimonials.ts` (Trouwshoot – Majella & Mark, Newbornshoot – Demi & Kevin), `HomeContent.testimonials`.
|
||||
- **Images**: the two live review photos.
|
||||
- **Functional Design**: **executed** — carousel behaviour, announcements, edge cases (0 / 1 / many reviews), properties for PBT-01.
|
||||
- **Done when**: keyboard, swipe and indicator navigation work and are announced; axe clean; `pnpm check` green.
|
||||
|
||||
## Unit 5 — Contact
|
||||
- **Section**: `components/home/ContactSection` (`id="contact"`, heading, lead) with `components/ContactForm/ContactFormGate` around `components/ContactForm/ContactForm`.
|
||||
- **Logic**: `lib/shootOptions`, `lib/validateContact`, `lib/toContactPayload`, `lib/isLikelySpam`; `contact/types.ts`, `contact/submitContactForm.ts` (adapter, rejects generically today).
|
||||
- **Content**: `siteContent.contactForm = { enabled: false }`, `HomeContent.contact`.
|
||||
- **Theme**: field styling (square inputs, select chevron, error colour with sufficient contrast); `linkButton` recipe on a `<button>`.
|
||||
- **Functional Design**: **executed** — validation rules and messages, limits, spam rules, gate behaviour (on/off, invalid e-mail), submit states, preselection from unit 3, properties for PBT-01.
|
||||
- **Done when**: gate shows the coming-soon notice with mail button and the form is inert; with `enabled: true` (in tests) validation, spam filter and submit states work; preselection from "Boek je shoot" works; `pnpm check` green.
|
||||
|
||||
## Unit 6 — Instagram
|
||||
- **Section**: `components/home/InstagramGrid` — heading "Instagram", handle link, six square tiles (6 / 3 / 2 columns) linking to the profile in a new tab.
|
||||
- **Content**: `HomeContent.instagram` (title, handle, six photos); profile URL derived from `siteContent.socials` in the route.
|
||||
- **Images**: six existing site photos, reusing already-bundled assets where possible (Andrea can swap them).
|
||||
- **Functional Design**: skipped (presentational).
|
||||
- **Done when**: section renders last; hidden without a valid Instagram URL; external link attributes and screen reader hint present; `pnpm check` green.
|
||||
|
||||
---
|
||||
|
||||
## After the units
|
||||
**Build and Test** for the whole homepage (section order, Prijzen → Contact across sections, Lighthouse on the complete page), then one PR from `feature/homepage-sections` to `master`. The Operations decision is asked again there.
|
||||
Reference in New Issue
Block a user