import React from 'react' import type { FDUspChecklistBlock as FDUspChecklistBlockProps, Media } from '@/payload-types' import { FDImage } from '@/components/FDImage' const bgMap: Record = { white: 'bg-white dark:bg-fd-navy', gray: 'bg-fd-gray-light dark:bg-fd-navy', navy: 'bg-fd-navy', } const headingMap: Record = { navy: 'text-fd-navy dark:text-fd-yellow', white: 'text-white', } const bodyMap: Record = { navy: 'text-fd-navy dark:text-white', white: 'text-white', } 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 FDUspChecklistBlockComponent: React.FC = ({ heading, items, image, imagePosition = 'right', checkColor = 'navy', sectionBackground = 'white', textColor = 'navy', anchorId, }) => { const bg = bgMap[sectionBackground || 'white'] const headClr = headingMap[textColor || 'navy'] const bodyClr = bodyMap[textColor || 'navy'] const media = image as Media | undefined const hasImage = Boolean(media?.url) const textContent = (

{heading}

{items?.map((item, index) => (
{item.text}
))}
) const imageContent = hasImage ? (
) : null return (
{imagePosition === 'left' ? <>{imageContent}{textContent} : <>{textContent}{imageContent}}
) }