Skip to content
SprecherEast
Issue 460

tech-debt: Page-builder heroes take plain props (PageHero)

Back to our plan
Done
frontendtech-debtpriority: medium

Summary

Bring the three page-builder heroes (high, medium, low impact) into one PageHero component that takes plain props mapped from the CMS, as decision 0013 says. Editors and visitors see the same pages; the hero code stops reading raw CMS data.

Details

Today HighImpactHero, MediumImpactHero and LowImpactHero each take the generated Page['hero'] type, and RenderHero picks one (H1, H4, H5 in docs/ui/). The component set (docs/ui/component-set-modules.md, row PageHero) gives them one component:

  • PageHero: variant: high, medium, low; title and body (RichTextValue), image (ImageRef), links (ResolvedLink[]). Built from Media, RichText and Button (LinkButton).

Following 0013, as #457 did for the blocks:

  • PageHeroProps in src/modules/site/domain/; toPageHeroProps in src/modules/site/data/mappers.ts, links through resolveLink()
  • getPageBySlug returns the hero already mapped (none maps to no hero)
  • the CMS hero field config (src/modules/site/cms/hero.ts) doesn't change, so editors see no difference

The standalone post and event heroes move separately (they become PageHeader · image).

Acceptance criteria

  • Not done: One PageHero with the three variants replaces the three hero components and RenderHero; it doesn't import @/payload-types.
  • Not done: toPageHeroProps has unit tests, including a hero with no image, no links and type none.
  • Not done: Home and the low-impact pages look the same at the six widths in both themes (or each change is listed and follows the design rules).
  • Not done: docs/ui/ says what exists.

Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab