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>
4.6 KiB
4.6 KiB
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 unit 2; design reference
design/andreaslop-static/index.html(.about,.about__media,.about__body,.link-underline) andstyle.css§5, §12 - Depends on: unit 1 (
HomeSection,SectionHeading,Reveal,DeferredImage,ContentImage,homeContent.ts) - Introduces:
FramedImage(reused by unit 4), theunderlinelink 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
- 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, intoweb/src/assets/home/andrea.jpg, with the resize script from unit 1.
Content
- Step 2 —
content/types.ts: extendHomeContentwithabout: { eyebrow; title; paragraphs: string[]; image: ContentImage; link: { label; to: RoutePath } }(RoutePathfromnavigation.ts, so a wrong route is a type error). - 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
- Step 4 —
recipes/link.ts: add variantunderline(design.link-underline): ink text, 1px underline incurrentColorthat slides in from the left on hover and focus,interactionduration,smootheasing, no motion under reduced motion. Used withasChildaroundRouterLink, like the footer menu. - Step 5 —
SectionHeading: optionalspacing: 'default' | 'compact'(compact =1.5rembelow, design.about__body h2), so the about text can use the same heading block left-aligned. Test for the compact variant. - Step 6 —
components/FramedImage/FramedImage.tsx:DeferredImagewith a fixedaspectRatioon apaper.deepplaceholder, plus the decorative sand block behind it (bottom-left, offset 1.5rem, 55% × 55%,sand), hidden belowsm; the block is CSS only (::before), so it is never announced. - Step 7 —
components/FramedImage/FramedImage.test.tsx: image with alt and dimensions, lazy, axe clean.
The section
- Step 8 —
components/home/AboutBlock/AboutBlock.tsx:HomeSectionwithtone="alt"; grid 1 column, 2 equal columns fromlg, gapclamp(2rem, 6vw, 5.5rem), vertically centred; leftFramedImage(aspect 4/3) in aReveal; right in aReveal:SectionHeading(eyebrow, h2, start-aligned, compact), the paragraphs (ink.soft), and the link with theunderlinevariant. - Step 9 —
components/home/AboutBlock/AboutBlock.test.tsx: region named by the h2, eyebrow, three paragraphs, photo alt, link to/over-mij, axe clean. - Step 10 —
routes/index.tsx: renderAboutBlockafterIntroGallery. - Step 11 —
app.test.tsx: add the "Over mij" section (named by its h2) to the page-order check.
Verification and wrap-up
- Step 12 —
pnpm check(incl. Lighthouse); fix and rerun until green. Visual check at desktop width and at an emulated 390 px phone. - Step 13 —
construction/over-mij/code/code-summary.md. - Step 14 — Commit on
feature/homepage-sections("Adds the Over mij section to the homepage" + attribution). Not pushed.
Fix during Step 12
- 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.