From b0d76c891fde1f65294d1a2159582b0db55b4373 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 26 Aug 2026 20:50:25 +0000 Subject: [PATCH] Frontend support for Hero block's optional portrait image --- app/components/PageBlocks.tsx | 33 ++++++++++++++++++++++++++------- app/lib/payload.ts | 5 +++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/components/PageBlocks.tsx b/app/components/PageBlocks.tsx index 48dcf77..3cc7140 100644 --- a/app/components/PageBlocks.tsx +++ b/app/components/PageBlocks.tsx @@ -40,15 +40,33 @@ export function renderPageBlockSync(block: PageBlock): React.ReactNode { // (/lebensuhr, /3x3-system, /ueber-mich) used for its own H1 before // this block existed — see HeroBlock.ts's own comment on why the // headline moved out of Pages.title and into here. - case "hero": + case "hero": { + const headline = ( +

+ {block.headline} +

+ ); return (
-

- {block.headline} -

+ {/* Optional round portrait beside the headline — e.g. /ueber-mich's + "Hallo, ich bin Björn." */} + {block.image ? ( +
+
+ +
+ {headline} +
+ ) : ( + headline + )} {block.subline &&

{block.subline}

} {block.ctaLabel && block.ctaHref && ( ); + } case "richTextSection": return ; diff --git a/app/lib/payload.ts b/app/lib/payload.ts index 56fda65..5d58524 100644 --- a/app/lib/payload.ts +++ b/app/lib/payload.ts @@ -1293,7 +1293,7 @@ export async function getTrackingCodes(): Promise { // full page section, not an inline prose element. export type PageBlock = - | { blockType: "hero"; id: string; headline: string; subline: string | null; ctaLabel: string | null; ctaHref: string | null } + | { blockType: "hero"; id: string; headline: string; subline: string | null; image: string | null; ctaLabel: string | null; ctaHref: string | null } | { blockType: "richTextSection"; id: string; content: unknown } | { blockType: "stepRow"; id: string; items: { id: string; icon: string; title: string; subtitle: string | null; description: string }[] } | { blockType: "quote"; id: string; text: string; label: string | null } @@ -1318,7 +1318,7 @@ export type Page = { type PayloadPageImageField = { url?: string | null } | number | null; type PayloadPageBlock = - | { blockType: "hero"; id: string; headline: string; subline?: string | null; ctaLabel?: string | null; ctaHref?: string | null } + | { blockType: "hero"; id: string; headline: string; subline?: string | null; image?: PayloadPageImageField; ctaLabel?: string | null; ctaHref?: string | null } | { blockType: "richTextSection"; id: string; content: unknown } | { blockType: "stepRow"; id: string; items: { id: string; icon: string; title: string; subtitle?: string | null; description: string }[] } | { blockType: "quote"; id: string; text: string; label?: string | null } @@ -1366,6 +1366,7 @@ function mapPayloadPageBlock(block: PayloadPageBlock): PageBlock { id: block.id, headline: block.headline, subline: block.subline ?? null, + image: mapPayloadPageImage(block.image ?? null), ctaLabel: block.ctaLabel ?? null, ctaHref: block.ctaHref ?? null, };