import React from 'react' import type { FDPricingCardBlock as FDPricingCardBlockProps } from '@/payload-types' import { FDButton } from '@/components/FDButton' import { fdCardRadius as cardRadius, fdContainer} from '@/utilities/fdTheme' const sectionBgMap: Record = { white: 'bg-white dark:bg-fd-navy', navy: 'bg-fd-navy', gray: 'bg-fd-gray-light dark:bg-fd-navy', yellow: 'bg-fd-yellow', } const titleColorMap: Record = { navy: 'text-fd-navy dark:text-fd-yellow', white: 'text-white', yellow: 'text-fd-yellow', } const cardStyleMap: Record = { outlined: { bg: 'bg-white dark:bg-white/10', border: 'border-[5px] border-gray-200 dark:border-white/20', title: 'text-fd-navy dark:text-fd-yellow', subtitle: 'text-fd-navy dark:text-white', body: 'text-fd-navy/80 dark:text-white/80', bullet: 'text-fd-navy dark:text-white', isDark: false, }, navy: { bg: 'bg-fd-navy dark:bg-white/10', border: '', title: 'text-fd-yellow', subtitle: 'text-white', body: 'text-white/80', bullet: 'text-white', isDark: true, }, gray: { bg: 'bg-fd-gray-light dark:bg-white/10', border: '', title: 'text-fd-navy dark:text-white', subtitle: 'text-fd-navy dark:text-white', body: 'text-fd-navy/80 dark:text-white/80', bullet: 'text-fd-navy dark:text-white', isDark: false, }, yellow: { bg: 'bg-fd-yellow', border: '', title: 'text-fd-navy', subtitle: 'text-fd-navy', body: 'text-fd-navy/80', bullet: 'text-fd-navy', isDark: false, }, white: { bg: 'bg-white dark:bg-white/10 shadow-fd-card dark:shadow-none', border: '', title: 'text-fd-navy dark:text-fd-yellow', subtitle: 'text-fd-navy dark:text-white', body: 'text-fd-navy/80 dark:text-white/80', bullet: 'text-fd-navy dark:text-white', isDark: false, }, } const buttonVariantMap: Record = { yellow: { variant: 'primary' }, navy: { variant: 'primary' }, outlinedNavy: { variant: 'outline' }, outlinedWhite: { variant: 'outline' }, } const gridColsMap: Record = { 1: 'min-[820px]:grid-cols-1 max-w-[500px] mx-auto', 2: 'min-[820px]:grid-cols-2', 3: 'min-[820px]:grid-cols-3', } export const FDPricingCardBlockComponent: React.FC = ({ sectionTitle, cards, cardStyle = 'outlined', buttonColor = 'yellow', sectionBackground = 'white', titleColor = 'navy', anchorId, }) => { const sectionBg = sectionBgMap[sectionBackground || 'white'] const sectionTitleColor = titleColorMap[titleColor || 'navy'] const style = cardStyleMap[cardStyle || 'outlined'] const { variant } = buttonVariantMap[buttonColor || 'yellow'] const cardCount = cards?.length || 1 const gridCols = gridColsMap[cardCount] || gridColsMap[3] const outlineOnDark = style.isDark return (
{sectionTitle && (

{sectionTitle}

)}
{cards?.map((card, index) => (

{card.title}

{card.subtitle && (

{card.subtitle}

)} {card.description && (

{card.description}

)} {card.bulletPoints && card.bulletPoints.length > 0 && (
    {card.bulletPoints.map((point, i) => (
  • {point.text}
  • ))}
)} {card.ctaText && (
{card.ctaText}
)}
))}
) }