5.2 KiB
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,MediaTextlayout-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: ChakraTextwithtextStyle="eyebrow",color="accent.deep",mb={4}, anasprop ('p' | 'span' | 'h2' | 'h3' | 'h4', defaultp) and pass-throughTextProps. Comment: whyaccent.deep(4.5:1). - Step 2 — Create
components/Eyebrow/Eyebrow.test.tsx: renders a paragraph by default; withas="h3"it is a level-3 heading with that name and can carry anid; 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 whereEyebrownow carries the reason.
PageSection
- Step 4 — Rename
components/HomeSection/→components/PageSection/(git mvfor 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 asdefault(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 forflushTop(top padding 0, bottom padding kept).
MediaText
- Step 8 — Create
components/MediaText/MediaText.tsx: grid1fr→1fr 1frfromlg, gapclamp(2rem, 6vw, 5.5rem),alignItems="center"; first columnReveal→FramedImage image aspectRatio; second columnReveal→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/AboutBlocktoPageSection+MediaText(the text column keepsSectionHeading, the paragraphs and the link).AboutBlock.test.tsxpasses unchanged.
Verification and summary
- Step 11 — Search for leftovers: no
HomeSectionreferences inweb/(code, tests, comments); no duplicate component files. - Step 12 — Run
pnpm checkinweb/(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 listEyebrow,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) |