# 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.