import React from 'react' import type { FDCardGridBlock as FDCardGridBlockProps } from '@/payload-types' const cardStyleMap: Record< string, { bg: string; headingText: string; bodyText: string; linkText: string; border: string } > = { navy: { bg: 'bg-fd-navy dark:bg-white/10', headingText: 'text-fd-yellow', bodyText: 'text-white', linkText: 'text-fd-yellow hover:text-fd-yellow/80', border: '', }, gray: { bg: 'bg-fd-gray-light dark:bg-white/10', headingText: 'text-fd-navy dark:text-fd-yellow', bodyText: 'text-fd-navy dark:text-white', linkText: 'text-fd-navy hover:text-fd-navy/70 dark:text-fd-yellow dark:hover:text-fd-yellow/80', border: '', }, yellow: { bg: 'bg-fd-yellow', headingText: 'text-fd-navy', bodyText: 'text-fd-navy', linkText: 'text-fd-navy hover:text-fd-navy/70', border: '', }, green: { /* Priority #9: Was bg-[#4ADE80] (Tailwind default) — now uses brand mint */ bg: 'bg-fd-mint', headingText: 'text-fd-navy', bodyText: 'text-fd-navy', linkText: 'text-fd-navy hover:text-fd-navy/70', border: '', }, outlined: { bg: 'bg-white dark:bg-white/10', headingText: 'text-fd-navy dark:text-fd-yellow', bodyText: 'text-fd-navy dark:text-white', linkText: 'text-fd-navy/70 hover:text-fd-navy dark:text-fd-yellow/80 dark:hover:text-fd-yellow', border: 'border-5 border-gray-200 dark:border-white/10 shadow-fd-card', }, } const sectionBgMap: Record = { white: 'bg-white dark:bg-fd-navy', navy: 'bg-fd-navy', gray: 'bg-fd-gray-light dark:bg-fd-navy', } const layoutGridMap: Record = { '1-2': 'min-[820px]:grid-cols-[1fr_2fr]', '2-1': 'min-[820px]:grid-cols-[2fr_1fr]', '1-1-1': 'min-[820px]:grid-cols-3', '1-1': 'min-[820px]:grid-cols-2', } const styleClassMap: Record = { normal: '', bold: 'font-joey-bold', italic: 'italic', boldItalic: 'font-joey-bold italic', } /* Priority #5: Responsive radius constant */ const cardRadius = 'rounded-[32px] md:rounded-[50px] lg:rounded-[70px]' export const FDCardGridBlockComponent: React.FC = ({ layout = '1-1-1', cardStyle = 'outlined', cards, sectionBackground = 'white', anchorId, }) => { const style = cardStyleMap[cardStyle] || cardStyleMap.outlined const sectionBg = sectionBgMap[sectionBackground || 'white'] const gridCols = layoutGridMap[layout] || layoutGridMap['1-1-1'] return (
{cards?.map((card, index) => { const mode = card.displayMode || 'content' let cardContent: React.ReactNode if (mode === 'centeredHeading') { cardContent = (
{card.heading}
) } else if (mode === 'centeredBody') { cardContent = (

{card.centeredBodyText}

) } else { cardContent = (
{card.heading && (

{card.heading}

)} {card.contentLines?.map((line, lineIndex) => { const textStyle = styleClassMap[line.style || 'normal'] || '' const baseClass = `font-joey text-fd-body-lg ${style.bodyText} ${textStyle}` if (line.link) { return ( {line.text} ) } return (

{line.text}

) })}
) } if (card.cardLink) { return ( {cardContent} ) } return
{cardContent}
})}
) }