fix: read card link/linkText as flat fields instead of nested object

The CMS card-grid-block defines link (URL) and linkText (label) as
separate text fields, but the component treated link as a group object
with href/label sub-fields. Also prioritize headline over title to
match the CMS field name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
CCS Admin 2026-02-25 16:51:35 +00:00
parent 802f58ad17
commit d236d0e9f1

View file

@ -13,7 +13,7 @@ interface CardGridBlockProps {
}
export function CardGridBlock({ block }: CardGridBlockProps) {
const title = (block.title as string) || (block.headline as string) || ''
const title = (block.headline as string) || (block.title as string) || ''
const subtitle = (block.subtitle as string) || ''
const cards = (block.cards as Array<Record<string, unknown>>) || []
const columns = (block.columns as number) || 3
@ -46,9 +46,8 @@ export function CardGridBlock({ block }: CardGridBlockProps) {
const iconPosition = (card.iconPosition as string) || 'top'
const cardImage = card.image as Record<string, unknown> | undefined
const cardImageUrl = cardImage?.url as string | undefined
const cardLink = card.link as Record<string, unknown> | undefined
const cardLinkLabel = (cardLink?.label as string) || 'Mehr erfahren'
const cardLinkHref = (cardLink?.href as string) || (cardLink?.url as string) || ''
const cardLinkHref = (card.link as string) || ''
const cardLinkLabel = (card.linkText as string) || 'Mehr erfahren'
const isIconLeft = mediaType === 'icon' && iconPosition === 'left'