Adds the Lifestyle fotografie section to the homepage
Adds the first block below the hero: heading, intro and a staggered gallery of four live photos. Brings in the shared section building blocks (HomeSection, SectionHeading, Reveal) and DeferredImage, which holds back below-the-fold photos until the page has loaded so they do not compete with the hero for bandwidth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+23
-20
@@ -18,13 +18,13 @@
|
||||
## Steps
|
||||
|
||||
### Branch and baseline
|
||||
- [ ] **Step 1** — Create branch `feature/homepage-sections` from `master`. First commit: the inception artifacts so far (`aidlc-docs/…/homepage-sections/`, refreshed `aidlc-docs/_shared/reverse-engineering/`, `active-features.md`) and the static design update (`design/andreaslop-static/`, `LAYOUT.md`, `.ai/layout-conventions.md`). Not pushed.
|
||||
- [x] **Step 1** — Create branch `feature/homepage-sections` from `master`. First commit: the inception artifacts so far (`aidlc-docs/…/homepage-sections/`, refreshed `aidlc-docs/_shared/reverse-engineering/`, `active-features.md`) and the static design update (`design/andreaslop-static/`, `LAYOUT.md`, `.ai/layout-conventions.md`). Not pushed.
|
||||
|
||||
### Images
|
||||
- [ ] **Step 2** — Resize the four live gallery photos (`design/andreaslop-static/assets/img/intro-1…4.jpg`, 1067×1600) to **800×1200**, JPEG quality ~80, into `web/src/assets/home/intro-1.jpg … intro-4.jpg`. Tool: a one-off PowerShell script using .NET `System.Drawing` (already on Windows; not added to the project). The script and its parameters are recorded in the code summary so later units reuse them. Target ≤ ~150 KB per photo.
|
||||
- [x] **Step 2** — Resize the four live gallery photos (`design/andreaslop-static/assets/img/intro-1…4.jpg`, 1067×1600) to **800×1200**, JPEG quality ~80, into `web/src/assets/home/intro-1.jpg … intro-4.jpg`. Tool: a one-off PowerShell script using .NET `System.Drawing` (already on Windows; not added to the project). The script and its parameters are recorded in the code summary so later units reuse them. Target ≤ ~150 KB per photo.
|
||||
|
||||
### Theme (shared)
|
||||
- [ ] **Step 3** — `web/src/theme.ts`: add tokens from the design that later units also need:
|
||||
- [x] **Step 3** — `web/src/theme.ts`: add tokens from the design that later units also need:
|
||||
- spacing `sectionY` (`clamp(4.5rem, 9vw, 8.5rem)`), `sectionYTight` (60% of it), `gridGap` (`clamp(1rem, 2.2vw, 2rem)`), `sectionHeadGap` (`clamp(2.5rem, 5vw, 4.5rem)`)
|
||||
- size `contentNarrow` (`820px`)
|
||||
- text styles `sectionTitle` (Marcellus; 1.85 / 2.125 / 2.5rem, line-height 1.15) and `lead` (1.25rem, weight 300, line-height 1.6)
|
||||
@@ -32,33 +32,36 @@
|
||||
- then run `pnpm typegen`
|
||||
|
||||
### Content
|
||||
- [ ] **Step 4** — `web/src/content/types.ts`: add `ContentImage` and `HomeContent` with the `intro` part only (`{ title, lead, photos: ContentImage[] }`); later units extend `HomeContent`.
|
||||
- [ ] **Step 5** — Create `web/src/content/homeContent.ts`: title "Lifestyle fotografie", lead "Jouw favoriete momenten, vastgelegd op een natuurlijke en ongedwongen manier.", four photos with width/height 800×1200 and alt texts:
|
||||
- [x] **Step 4** — `web/src/content/types.ts`: add `ContentImage` and `HomeContent` with the `intro` part only (`{ title, lead, photos: ContentImage[] }`); later units extend `HomeContent`.
|
||||
- [x] **Step 5** — Create `web/src/content/homeContent.ts`: title "Lifestyle fotografie", lead "Jouw favoriete momenten, vastgelegd op een natuurlijke en ongedwongen manier.", four photos with width/height 800×1200 and alt texts:
|
||||
1. "Babyhandje in de hand van de moeder, op een gebreid dekentje"
|
||||
2. "Moeder drukt haar pasgeboren baby in een gebreid truitje tegen zich aan"
|
||||
3. "Zwangere vrouw op blote voeten in het zand bij zonsondergang"
|
||||
4. "Aanstaande vader omarmt zijn zwangere partner in de duinen"
|
||||
|
||||
### Shared blocks
|
||||
- [ ] **Step 6** — `web/src/hooks/useReveal.ts`: returns `{ ref, visible }`; visible immediately when `prefers-reduced-motion: reduce` or `IntersectionObserver` is missing; otherwise observes once (threshold 0.12, rootMargin `0px 0px -60px 0px`, as in the design) and disconnects on reveal and on unmount.
|
||||
- [ ] **Step 7** — `web/src/hooks/useReveal.test.tsx`: visible without IntersectionObserver (jsdom); visible under reduced motion; hidden until intersecting with a mocked observer, then visible, then unobserved; disconnect on unmount.
|
||||
- [ ] **Step 8** — `web/src/components/Reveal/Reveal.tsx`: wraps children in a `Box`; opacity 0 + translateY(24px) until visible, transition `reveal` duration with the `smooth` easing; optional `delay` (seconds) for staggering.
|
||||
- [ ] **Step 9** — `web/src/components/Reveal/Reveal.test.tsx`: children always in the DOM and accessible; visible state without observer.
|
||||
- [ ] **Step 10** — `web/src/components/SectionHeading/SectionHeading.tsx`: optional eyebrow (`eyebrow` text style, `accent.deep`), h2 with `id` (`sectionTitle` text style), optional lead (`lead` text style, `ink.soft`); `align` center (default, max width 620px, centred) or start; bottom margin `sectionHeadGap`.
|
||||
- [ ] **Step 11** — `web/src/components/SectionHeading/SectionHeading.test.tsx`: h2 with id, optional eyebrow/lead, axe clean.
|
||||
- [ ] **Step 12** — `web/src/components/HomeSection/HomeSection.tsx`: `<section aria-labelledby>` with `py="sectionY"` (or `sectionYTight`), `bg` `paper` or `paper.alt` (`tone`), inner `Container` (`content` or `contentNarrow` width), optional `id` and `data-testid`.
|
||||
- [ ] **Step 13** — `web/src/components/HomeSection/HomeSection.test.tsx`: region named by its heading, tone and width variants render, id passes through.
|
||||
- [x] **Step 6** — `web/src/hooks/useReveal.ts`: returns `{ ref, visible }`; visible immediately when `prefers-reduced-motion: reduce` or `IntersectionObserver` is missing; otherwise observes once (threshold 0.12, rootMargin `0px 0px -60px 0px`, as in the design) and disconnects on reveal and on unmount.
|
||||
- [x] **Step 7** — `web/src/hooks/useReveal.test.tsx`: visible without IntersectionObserver (jsdom); visible under reduced motion; hidden until intersecting with a mocked observer, then visible, then unobserved; disconnect on unmount.
|
||||
- [x] **Step 8** — `web/src/components/Reveal/Reveal.tsx`: wraps children in a `Box`; opacity 0 + translateY(24px) until visible, transition `reveal` duration with the `smooth` easing; optional `delay` (seconds) for staggering.
|
||||
- [x] **Step 9** — `web/src/components/Reveal/Reveal.test.tsx`: children always in the DOM and accessible; visible state without observer.
|
||||
- [x] **Step 10** — `web/src/components/SectionHeading/SectionHeading.tsx`: optional eyebrow (`eyebrow` text style, `accent.deep`), h2 with `id` (`sectionTitle` text style), optional lead (`lead` text style, `ink.soft`); `align` center (default, max width 620px, centred) or start; bottom margin `sectionHeadGap`.
|
||||
- [x] **Step 11** — `web/src/components/SectionHeading/SectionHeading.test.tsx`: h2 with id, optional eyebrow/lead, axe clean.
|
||||
- [x] **Step 12** — `web/src/components/HomeSection/HomeSection.tsx`: `<section aria-labelledby>` with `py="sectionY"` (or `sectionYTight`), `bg` `paper` or `paper.alt` (`tone`), inner `Container` (`content` or `contentNarrow` width), optional `id` and `data-testid`.
|
||||
- [x] **Step 13** — `web/src/components/HomeSection/HomeSection.test.tsx`: region named by its heading, tone and width variants render, id passes through.
|
||||
|
||||
### The section
|
||||
- [ ] **Step 14** — `web/src/components/home/IntroGallery/IntroGallery.tsx`: `HomeSection` + `SectionHeading` (in `Reveal`) + grid of four `figure`s, each in a `Reveal` with a staggered delay; 4 columns from `lg`, 2 from `sm`, 1 below; 2nd and 4th photo offset downward from `sm` (design `margin-top`); image `aspectRatio 3/4`, `objectFit cover`, `loading="lazy"`, explicit width/height; slow hover zoom (1.05, `fade` duration), none under reduced motion.
|
||||
- [ ] **Step 15** — `web/src/components/home/IntroGallery/IntroGallery.test.tsx`: region "Lifestyle fotografie", h2 + lead, four images with their alt texts and lazy loading, works with any number of photos (0 shows only the heading), axe clean.
|
||||
- [ ] **Step 16** — `web/src/routes/index.tsx`: render `IntroGallery` with `homeContent.intro` after the Hero.
|
||||
- [ ] **Step 17** — `web/src/app.test.tsx`: the homepage shows the "Lifestyle fotografie" section after the hero, still exactly one h1, axe clean (extend the existing home checks).
|
||||
- [x] **Step 14** — `web/src/components/home/IntroGallery/IntroGallery.tsx`: `HomeSection` + `SectionHeading` (in `Reveal`) + grid of four `figure`s, each in a `Reveal` with a staggered delay; 4 columns from `lg`, 2 from `sm`, 1 below; 2nd and 4th photo offset downward from `sm` (design `margin-top`); image `aspectRatio 3/4`, `objectFit cover`, `loading="lazy"`, explicit width/height; slow hover zoom (1.05, `fade` duration), none under reduced motion.
|
||||
- [x] **Step 15** — `web/src/components/home/IntroGallery/IntroGallery.test.tsx`: region "Lifestyle fotografie", h2 + lead, four images with their alt texts and lazy loading, works with any number of photos (0 shows only the heading), axe clean.
|
||||
- [x] **Step 16** — `web/src/routes/index.tsx`: render `IntroGallery` with `homeContent.intro` after the Hero.
|
||||
- [x] **Step 17** — `web/src/app.test.tsx`: the homepage shows the "Lifestyle fotografie" section after the hero, still exactly one h1, axe clean (extend the existing home checks).
|
||||
|
||||
### Verification and wrap-up
|
||||
- [ ] **Step 18** — Run `pnpm check` (lint, format, tests incl. coverage thresholds, build, audits, Lighthouse mobile + desktop). Fix and rerun until green.
|
||||
- [ ] **Step 19** — Write `aidlc-docs/features/homepage-sections/construction/lifestyle-fotografie/code/code-summary.md`: files created/modified, image script + parameters and resulting sizes, test results, Lighthouse scores, extension compliance.
|
||||
- [ ] **Step 20** — Commit unit 1 on `feature/homepage-sections` ("Adds the Lifestyle fotografie section to the homepage" + attribution). Not pushed.
|
||||
- [x] **Step 18** — Run `pnpm check` (lint, format, tests incl. coverage thresholds, build, audits, Lighthouse mobile + desktop). Fix and rerun until green.
|
||||
- [x] **Step 19** — Write `aidlc-docs/features/homepage-sections/construction/lifestyle-fotografie/code/code-summary.md`: files created/modified, image script + parameters and resulting sizes, test results, Lighthouse scores, extension compliance.
|
||||
- [x] **Step 20** — Commit unit 1 on `feature/homepage-sections` ("Adds the Lifestyle fotografie section to the homepage" + attribution). Not pushed.
|
||||
|
||||
### Fix during Step 18 (Step 13.5 self-check)
|
||||
- [x] **Step 18a** — Lighthouse home mobile failed (0.78 < 0.8; LCP 3.8 s → 5.3 s). Root cause: Chrome fetches `loading="lazy"` images within ±1250 px of the viewport immediately, so the gallery photos right under the hero competed with the hero for bandwidth under Lighthouse's throttling. Fix: `hooks/useInView.ts` (shared observer logic; `useReveal` now builds on it), `hooks/usePageLoaded.ts`, `components/DeferredImage` (sets `src` only after the load event and when within 600 px of the viewport; width/height reserve the space), `test/fakeIntersectionObserver.ts` (shared test double); IntroGallery uses DeferredImage with a `paper.deep` placeholder. Result: mobile 0.85 (LCP 3.8 s, equal to master).
|
||||
|
||||
## Requirement traceability
|
||||
| Requirement | Steps |
|
||||
|
||||
Reference in New Issue
Block a user