Adds the Over mij section to the homepage

Adds the introduction block with a framed photo of Andrea and a link to
the about page. Brings in FramedImage and an underline link variant for
the later blocks, and narrows the load margin of deferred photos so
nothing below the hero starts loading before the hero has painted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 00:31:10 +02:00
co-authored by Claude Opus 5.5
parent 3e530df0af
commit 0b54a67dc4
20 changed files with 403 additions and 14 deletions
@@ -0,0 +1,37 @@
# Code Summary — Unit 2: Over mij
Plan: [over-mij-code-generation-plan.md](../../plans/over-mij-code-generation-plan.md). Branch: `feature/homepage-sections`.
## Files
### Created
| File | Purpose |
|---|---|
| `web/src/assets/home/andrea.jpg` | Photo of Andrea, 1200×800, 75 KB (from the 1600×1067 original; the live site shows a 1024 px version) |
| `web/src/components/FramedImage/FramedImage.tsx` + test | Photo with the sand offset block behind it (CSS `::before`, hidden below `sm`); uses `DeferredImage` |
| `web/src/components/home/AboutBlock/AboutBlock.tsx` + test | The "Over mij" section |
### Modified
| File | Change |
|---|---|
| `web/src/content/types.ts` | `HomeContent.about`; the link target is a `RoutePath` |
| `web/src/content/homeContent.ts` | About content (live texts, photo, link to `/over-mij`) |
| `web/src/recipes/link.ts` | New `underline` variant (design `.link-underline`), reused by later units |
| `web/src/components/SectionHeading/*` | `spacing="compact"` for a heading above running text |
| `web/src/components/DeferredImage/*`, `IntroGallery.tsx` | Load margin 600 px → **200 px**, shared constant `DEFERRED_LOAD_MARGIN` (see below) |
| `web/src/routes/index.tsx` | Renders `AboutBlock` after `IntroGallery` |
| `web/src/app.test.tsx` | Page-order check includes the "Over mij" section |
## Fix during verification: deferred images raced the hero
The first `pnpm check` failed again on Lighthouse home mobile (0.77, LCP 5.3 s). Comparing all runs showed a race: when the gallery photos *started* before the observed LCP (164 ms vs 190 ms; 196 ms vs 219 ms) the simulated LCP was 5.3 s; when they started at or after it (221 ms vs 220 ms) it was 3.8 s. With a 600 px margin the gallery, ±240 px below the full-height hero, was "near" right after the load event. With 200 px nothing below the hero is in range when the page opens; the latest runs request none of those photos (mobile 0.84, LCP 3.9 s; desktop 1.0), so the result no longer depends on timing. Photos load as the visitor scrolls towards them; the placeholder and the reveal fade cover the short wait.
## Verification (`pnpm check`)
- Lint ✅, Prettier ✅, build ✅
- Tests: 32 files, **142 passed**
- `audit:deps` ✅; `audit:dev` report-only (unchanged)
- Lighthouse home: mobile **0.84**, desktop **1.0**; accessibility, best practices, SEO **1.0** on all URLs
- Visual check (CDP): desktop 1440 — photo with sand block left, text right; phone 390 — stacked, no block
## Extension compliance
- **Security Baseline**: no new dependencies or external resources (SECURITY-10/13); internal link only; other rules N/A.
- **PBT**: PBT-01 N/A (no logic); PBT-10 example-based tests for FramedImage, AboutBlock and the SectionHeading variant.
@@ -0,0 +1,56 @@
# Code Generation Plan — Unit 2: Over mij
**This plan is the single source of truth for Code Generation of unit 2.**
## Unit context
- **Requirements**: FR-HP-03, FR-HP-11 (reveal, reused), FR-HP-12, NFR-HP-01/02/03/05/06
- **Design**: [unit-of-work.md](../../inception/application-design/unit-of-work.md) unit 2; design reference `design/andreaslop-static/index.html` (`.about`, `.about__media`, `.about__body`, `.link-underline`) and `style.css` §5, §12
- **Depends on**: unit 1 (`HomeSection`, `SectionHeading`, `Reveal`, `DeferredImage`, `ContentImage`, `homeContent.ts`)
- **Introduces**: `FramedImage` (reused by unit 4), the `underline` link variant (reused by units 5 and 6)
- **Functional Design**: skipped (presentational). **PBT-01**: N/A — no business logic in this unit; example-based tests (PBT-10).
- Conventions as in unit 1 (English comments and test names, Dutch visitor text, `data-testid`, theme tokens, deferred images).
## Steps
### Image
- [x] **Step 1** — Resize the original live photo of Andrea (`WhatsApp-Image-2024-10-27-at-14.31.42.jpeg`, 1600×1067; the live site shows the 1024 px version) to **1200×800**, quality 80, into `web/src/assets/home/andrea.jpg`, with the resize script from unit 1.
### Content
- [x] **Step 2** — `content/types.ts`: extend `HomeContent` with `about: { eyebrow; title; paragraphs: string[]; image: ContentImage; link: { label; to: RoutePath } }` (`RoutePath` from `navigation.ts`, so a wrong route is a type error).
- [x] **Step 3** — `content/homeContent.ts`: eyebrow "Over mij", title "Lifestyle fotograaf met een passie voor storytelling", the three live paragraphs, the photo (alt "Andrea Slop met haar camera, glimlachend over haar schouder"), link "Lees mijn verhaal" → `/over-mij`.
### Shared pieces
- [x] **Step 4** — `recipes/link.ts`: add variant `underline` (design `.link-underline`): ink text, 1px underline in `currentColor` that slides in from the left on hover and focus, `interaction` duration, `smooth` easing, no motion under reduced motion. Used with `asChild` around `RouterLink`, like the footer menu.
- [x] **Step 5** — `SectionHeading`: optional `spacing: 'default' | 'compact'` (compact = `1.5rem` below, design `.about__body h2`), so the about text can use the same heading block left-aligned. Test for the compact variant.
- [x] **Step 6** — `components/FramedImage/FramedImage.tsx`: `DeferredImage` with a fixed `aspectRatio` on a `paper.deep` placeholder, plus the decorative sand block behind it (bottom-left, offset 1.5rem, 55% × 55%, `sand`), hidden below `sm`; the block is CSS only (`::before`), so it is never announced.
- [x] **Step 7** — `components/FramedImage/FramedImage.test.tsx`: image with alt and dimensions, lazy, axe clean.
### The section
- [x] **Step 8** — `components/home/AboutBlock/AboutBlock.tsx`: `HomeSection` with `tone="alt"`; grid 1 column, 2 equal columns from `lg`, gap `clamp(2rem, 6vw, 5.5rem)`, vertically centred; left `FramedImage` (aspect 4/3) in a `Reveal`; right in a `Reveal`: `SectionHeading` (eyebrow, h2, start-aligned, compact), the paragraphs (`ink.soft`), and the link with the `underline` variant.
- [x] **Step 9** — `components/home/AboutBlock/AboutBlock.test.tsx`: region named by the h2, eyebrow, three paragraphs, photo alt, link to `/over-mij`, axe clean.
- [x] **Step 10** — `routes/index.tsx`: render `AboutBlock` after `IntroGallery`.
- [x] **Step 11** — `app.test.tsx`: add the "Over mij" section (named by its h2) to the page-order check.
### Verification and wrap-up
- [x] **Step 12** — `pnpm check` (incl. Lighthouse); fix and rerun until green. Visual check at desktop width and at an emulated 390 px phone.
- [x] **Step 13** — `construction/over-mij/code/code-summary.md`.
- [x] **Step 14** — Commit on `feature/homepage-sections` ("Adds the Over mij section to the homepage" + attribution). Not pushed.
### Fix during Step 12
- [x] **Step 12a** — Lighthouse home mobile 0.77: deferred photos started before the observed LCP whenever they won a race (600 px margin reached the gallery right after the load event). Load margin lowered to 200 px and shared as `DEFERRED_LOAD_MARGIN` (DeferredImage + IntroGallery); no photo below the hero is requested on page open any more.
## Requirement traceability
| Requirement | Steps |
|---|---|
| FR-HP-03 | 2, 3, 6, 8–11 |
| FR-HP-11 | 8 |
| FR-HP-12 | 1–3 |
| NFR-HP-01 | 4, 6–9, 11, 12 |
| NFR-HP-02 | 4–8 |
| NFR-HP-03 | 5, 7, 9, 11, 12 |
| NFR-HP-05 | 1, 6, 12 |
| NFR-HP-06 | 2, 3 |
## Extension compliance (planned)
- **Security**: no new dependencies or external resources; internal link only; other rules N/A.
- **PBT**: PBT-01 N/A (no logic); PBT-10 example-based tests present.