Hero from the CMS: markers HERO-HTML and HERO-PRELOAD, hero key in the data block, picture per ratio, baked fallback

The prerendered hero is plain HTML between the markers (first photo, h1, buttons), the slider takes over after hydration with the hero of the host block, the API or the build. The head preload is added to the finished HTML. Hero texts move into nl.json. The stand-in host and the e2e tests cover the hero.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:48:00 +01:00
co-authored by Claude Sonnet 5.5
parent 13f78c48cd
commit ad0b114828
31 changed files with 863 additions and 134 deletions
+71
View File
@@ -28,6 +28,77 @@ const config = defineConfig({
'[tabindex="-1"]:focus': {
outline: 'none',
},
// The hero as the page first shows it: the plain HTML between the CMS
// markers (lib/heroHtml, components/Hero). Looks like the slider's first
// frame: the photo fills the hero, title and buttons are centred over
// it, the scrim (a later sibling) sits between them.
'[data-cms-region="HERO-HTML"]': {
position: 'absolute',
inset: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
color: 'white',
pt: 'header',
px: 'gutter',
},
'.cms-hero-picture': {
position: 'absolute',
inset: 0,
zIndex: 0,
display: 'block',
},
'.cms-hero-image': {
display: 'block',
width: '100%',
height: '100%',
objectFit: 'cover',
},
'.cms-hero-title': {
position: 'relative',
zIndex: 1,
margin: 0,
marginBottom: 9,
fontFamily: 'heading',
// Same as the Heading component the slider uses
fontWeight: '500',
letterSpacing: '0.2px',
color: 'white',
},
'.cms-hero-tagline': {
display: 'block',
marginBottom: 4,
fontFamily: 'body',
textStyle: 'eyebrow',
lineHeight: '1.5',
color: 'white/80',
},
'.cms-hero-name': { display: 'block', textStyle: 'display' },
'.cms-hero-buttons': {
position: 'relative',
zIndex: 1,
margin: 0,
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'center',
gap: 4,
},
'.cms-hero-button': {
display: 'inline-flex',
alignItems: 'center',
gap: 3,
px: '2.4rem',
py: '1.05rem',
borderWidth: '1px',
borderStyle: 'solid',
borderColor: 'white/70',
color: 'white',
textStyle: 'eyebrow',
fontWeight: '400',
textDecoration: 'none',
},
// The plain HTML between the CMS markers (components/CmsRegion): what
// the CMS host writes, shown until the styled cards take over after
// hydration. Looks like the cards (white, hairline border, centred),