import React from 'react' import type { FDIconBarBlock as FDIconBarBlockProps, 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', yellow: 'bg-fd-yellow', } const headingMap: Record = { navy: 'text-fd-navy dark:text-fd-yellow', white: 'text-white', } const labelMap: Record = { navy: 'text-fd-navy dark:text-white', white: 'text-white', } // Icon circle bg — navy circles become yellow-tinted in dark when on a now-navy section const iconBgMap: Record = { navy: 'bg-fd-navy dark:bg-white/10', yellow: 'bg-fd-yellow', gray: 'bg-fd-gray-light dark:bg-white/10', none: '', } export const FDIconBarBlockComponent: React.FC = ({ heading, icons, iconStyle = 'navy', sectionBackground = 'gray', textColor = 'navy', }) => { const bg = bgMap[sectionBackground || 'gray'] const headClr = headingMap[textColor || 'navy'] const labelClr = labelMap[textColor || 'navy'] const iconBg = iconBgMap[iconStyle || 'navy'] const hasCircle = iconStyle !== 'none' return (
{heading && (

{heading}

)}
{icons?.map((item, index) => { const media = item.icon as Media const content = (
{media?.url && ( )}
{item.label}
) if (item.link) { return ( {content} ) } return
{content}
})}
) }