Hero uit het CMS met ingebakken terugval: markers CMS:HERO-HTML, CMS:HERO-PRELOAD en CMS:DATA, hero-teksten naar nl.json, lint ook op Hero, tests en docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:48:56 +01:00
co-authored by Claude Sonnet 5.5
parent 72dd381cf9
commit 27c5ecb80f
16 changed files with 400 additions and 62 deletions
+33
View File
@@ -0,0 +1,33 @@
import { headingFromLines, titleLines, type CmsHero, type CmsHeroButton } from '../../../cms-client/hero';
import { heroContent } from './content';
/** What the hero components show: from the CMS when it delivered a hero, otherwise the baked texts. */
export interface ResolvedHero {
/** Text for screen readers and search engines (the sr-only part of the h1). */
heading: string;
/** The visible title, one entry per line. */
lines: string[];
lead: string | null;
buttons: CmsHeroButton[];
fromCms: boolean;
}
export function resolveHero(cms: CmsHero | null): ResolvedHero {
if (cms === null) {
return {
heading: heroContent.heading,
lines: heroContent.displayHeading,
lead: heroContent.lead,
buttons: heroContent.buttons,
fromCms: false,
};
}
const lines = titleLines(cms.title);
return {
heading: headingFromLines(lines, heroContent.headingPrefix),
lines,
lead: cms.lead,
buttons: cms.buttons,
fromCms: true,
};
}