Files
AndreaSlopFotografie/aidlc-docs/features/over-mij-page/construction/plans/shared-blocks-code-generation-plan.md
T
SluijsensandClaude Opus 5.5 01e849c6b0 Extracts shared section blocks for use beyond the homepage
HomeSection becomes PageSection, since every page needs the same section
frame, and gains a flushTop spacing for a block right below a page head.
The framed photo next to text from the homepage About block becomes
MediaText, and the accent label that four components wrote out by hand
becomes Eyebrow, which can also render as a heading. The homepage renders
exactly as before: a layout comparison of every element against master
at three widths shows no differences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 23:35:22 +02:00

5.2 KiB

Code Generation Plan — Unit 1: Shared blocks

Single source of truth for code generation of this unit. Workspace root: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie; all code in web/src/. Branch feature/over-mij-page.

Unit Context

  • Requirements: FR-OM-09 (HomeSection → PageSection), FR-OM-10 (shared media+text block), NFR-OM-02 (reuse, tokens, English comments), NFR-OM-03 (tests)
  • Design: application-design.md — Eyebrow (Q2), PageSection + flushTop, MediaText layout-only (Q1)
  • Dependencies: none on other units; unit 2 builds on everything here
  • Behavioural contract: the homepage renders exactly as before — same DOM roles, names, texts, styles. Existing tests must pass unchanged except for renamed imports/names.
  • No business logic, no new pure helpers → no property-based tests in this unit (PBT rules N/A: no properties to test in layout components). Example-based component tests + axe.

Steps

Eyebrow

  • Step 1 — Create components/Eyebrow/Eyebrow.tsx: Chakra Text with textStyle="eyebrow", color="accent.deep", mb={4}, an as prop ('p' | 'span' | 'h2' | 'h3' | 'h4', default p) and pass-through TextProps. Comment: why accent.deep (4.5:1).
  • Step 2 — Create components/Eyebrow/Eyebrow.test.tsx: renders a paragraph by default; with as="h3" it is a level-3 heading with that name and can carry an id; extra props (e.g. mb) pass through; axe clean.
  • Step 3 — Switch the four identical inline labels to Eyebrow (same output): SectionHeading, PageIntro, ContactForm/ContactFormGate, home/Testimonials/TestimonialSlide (only its shoot label, not the author line). Remove the then-duplicated contrast comments where Eyebrow now carries the reason.

PageSection

  • Step 4 — Rename components/HomeSection/ → components/PageSection/ (git mv for the component and its test), rename the component and props type, update the doc comment to "a content section on any page".
  • Step 5 — Add spacing="flushTop": no top padding, bottom padding as default (design .section--flush-top).
  • Step 6 — Update all importers: home/AboutBlock, home/ContactSection, home/InstagramGrid, home/IntroGallery, home/Pricing/Pricing, home/Testimonials/Testimonials.
  • Step 7 — Update PageSection.test.tsx: renamed; add a case for flushTop (top padding 0, bottom padding kept).

MediaText

  • Step 8 — Create components/MediaText/MediaText.tsx: grid 1fr → 1fr 1fr from lg, gap clamp(2rem, 6vw, 5.5rem), alignItems="center"; first column Reveal → FramedImage image aspectRatio; second column Reveal → children. Props: image, aspectRatio, data-testid?, children.
  • Step 9 — Create components/MediaText/MediaText.test.tsx: shows the image with its alt text and the children; photo comes before the text in DOM order; axe clean.
  • Step 10 — Switch home/AboutBlock to PageSection + MediaText (the text column keeps SectionHeading, the paragraphs and the link). AboutBlock.test.tsx passes unchanged.

Verification and summary

  • Step 11 — Search for leftovers: no HomeSection references in web/ (code, tests, comments); no duplicate component files.
  • Step 12 — Run pnpm check in web/ (lint, format, typecheck/build, tests with coverage, audits, Lighthouse). Fix and rerun until green.
  • Step 13 — Visual check of the homepage against master in the browser (desktop and phone width): About block, section headings, page intro of a placeholder page, contact notice, testimonial label — no visible difference.
  • Step 14 — Update the shared reverse engineering docs where they name HomeSection (architecture, code-structure, api-documentation, component-inventory, code-quality-assessment: debt item resolved) and list Eyebrow, MediaText.
  • Step 15 — Write aidlc-docs/features/over-mij-page/construction/shared-blocks/code/code-summary.md (created/modified files, tests, verification outcome).
  • Step 16 — Commit on feature/over-mij-page (no push until asked).

Files

  • Created: components/Eyebrow/Eyebrow.tsx, Eyebrow.test.tsx; components/MediaText/MediaText.tsx, MediaText.test.tsx
  • Renamed + modified: components/HomeSection/* → components/PageSection/PageSection.tsx, PageSection.test.tsx
  • Modified: components/SectionHeading/SectionHeading.tsx, components/PageIntro/PageIntro.tsx, components/ContactForm/ContactFormGate.tsx, components/home/Testimonials/TestimonialSlide.tsx, components/home/AboutBlock/AboutBlock.tsx, components/home/{ContactSection,InstagramGrid,IntroGallery,Pricing/Pricing,Testimonials/Testimonials}.tsx
  • Docs: aidlc-docs/_shared/reverse-engineering/*.md (names), unit code summary

Extension Compliance (unit 1)

Rule Status Rationale
SECURITY-10 Compliant No new dependencies
Other SECURITY rules N/A Presentational refactor; no data, endpoints, headers or config
PBT-01..10 N/A No pure functions or business logic in this unit; example-based component tests cover the layout contract (PBT-10 complementary testing applies in unit 2)