import React from 'react' import type { FDUspTableBlock as FDUspTableBlockProps } from '@/payload-types' import RichText from '@/components/RichText' const bgMap: Record = { white: 'bg-white dark:bg-fd-navy', gray: 'bg-fd-gray-light dark:bg-fd-navy', navy: 'bg-fd-navy', } // Heading: navy bg → yellow in dark const headingMap: Record = { navy: 'text-fd-navy dark:text-fd-yellow', white: 'text-white', } // Body / row titles: navy bg → white in dark const textMap: Record = { navy: 'text-fd-navy dark:text-white', white: 'text-white', } const proseMap: Record = { navy: 'text-fd-navy/80 dark:text-white/80', white: 'text-white/80', } const borderMap: Record = { navy: 'border-fd-navy/10 dark:border-white/20', white: 'border-white/20', } const checkColors: Record = { navy: { circle: 'fill-fd-navy dark:fill-white/20', check: 'fill-white dark:fill-fd-yellow' }, yellow: { circle: 'fill-fd-yellow', check: 'fill-fd-navy' }, gray: { circle: 'fill-fd-gray-light dark:fill-white/20', check: 'fill-fd-navy dark:fill-white' }, } const CheckIcon: React.FC<{ color: string }> = ({ color }) => { const c = checkColors[color] || checkColors.navy return ( ) } export const FDUspTableBlockComponent: React.FC = ({ heading, rows, checkColor = 'navy', sectionBackground = 'white', textColor = 'navy', anchorId, }) => { const bg = bgMap[sectionBackground || 'white'] const headClr = headingMap[textColor || 'navy'] const txt = textMap[textColor || 'navy'] const prose = proseMap[textColor || 'navy'] const border = borderMap[textColor || 'navy'] return (
{heading && (

{heading}

)}
{rows?.map((row, index) => (
{row.title}
))}
) }