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:
@@ -21,11 +21,19 @@ export interface NavLink {
|
||||
}
|
||||
|
||||
export interface HeroContent {
|
||||
/** Fixed text (not from the CMS): the small line in the code strip. */
|
||||
eyebrow: string;
|
||||
/** Fixed text: the prompt before the code line. */
|
||||
codePrompt: string;
|
||||
/** Brand prefix of the screen-reader heading when the hero comes from the CMS. */
|
||||
headingPrefix: string;
|
||||
heading: string;
|
||||
/** Display headline of design B, one entry per line ("Websites," / "apps" / "& meer."). */
|
||||
displayHeading: string[];
|
||||
lead: string;
|
||||
/** Baked buttons (label + target), the fallback of the CMS buttons. */
|
||||
buttons: { label: string; target: string }[];
|
||||
/** Fixed text (not from the CMS). */
|
||||
codeLine: string;
|
||||
}
|
||||
|
||||
@@ -89,12 +97,19 @@ export const navLinks: NavLink[] = [
|
||||
{ label: t('site.nav.cta'), href: '#contact', isCta: true },
|
||||
];
|
||||
|
||||
/** The baked hero: the fallback when the CMS delivers nothing. Texts live in the language file (home.hero). */
|
||||
export const heroContent: HeroContent = {
|
||||
eyebrow: 'Web & .NET development',
|
||||
heading: 'SLP software: websites, apps & meer',
|
||||
displayHeading: ['Websites,', 'apps', '& meer.'],
|
||||
lead: 'Bij SLP Software kun je terecht voor maatwerk oplossingen. Of het nou gaat om een website, cms of app: wij bouwen het allemaal. Voor ondernemers die geen verrassingen willen — niet in de code, niet op de factuur.',
|
||||
codeLine: 'var website = slp.Bouw(uwIdee);',
|
||||
eyebrow: t('home.hero.eyebrow'),
|
||||
codePrompt: t('home.hero.codePrompt'),
|
||||
headingPrefix: t('home.hero.headingPrefix'),
|
||||
heading: t('home.hero.fallback.heading'),
|
||||
displayHeading: [...tList('home.hero.fallback.lines')],
|
||||
lead: t('home.hero.fallback.lead'),
|
||||
buttons: [
|
||||
{ label: t('home.hero.fallback.ctaPackages'), target: '#pakketten' },
|
||||
{ label: t('home.hero.fallback.ctaContact'), target: '#contact' },
|
||||
],
|
||||
codeLine: t('home.hero.codeLine'),
|
||||
};
|
||||
|
||||
export const packages: PackageCardData[] = [
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user