import React from 'react' import type { FDHeaderTextImageBlock as FDHeaderTextImageBlockProps, Media } from '@/payload-types' import { FDImage } from '@/components/FDImage' const bgMap: Record = { white: 'bg-white', gray: 'bg-fd-gray-light', navy: 'bg-fd-navy', } const textMap: Record = { navy: 'text-fd-navy', white: 'text-white', } const overlayMap: Record = { none: '', navyLight: 'bg-fd-navy/20', navyMedium: 'bg-fd-navy/40', yellowLight: 'bg-fd-yellow/20', yellowMedium: 'bg-fd-yellow/40', sepia: 'bg-[#8B7D3C]/30', blackLight: 'bg-black/20', blackMedium: 'bg-black/40', } const roundedMap: Record = { none: '', medium: 'rounded-[24px]', large: 'rounded-[40px]', } export const FDHeaderTextImageBlockComponent: React.FC = ({ heading, body, image, imageOverlay = 'none', imageRounded = 'large', textAlign = 'center', background = 'white', textColor = 'navy', }) => { const bg = bgMap[background || 'white'] const txt = textMap[textColor || 'navy'] const overlay = overlayMap[imageOverlay || 'none'] const rounded = roundedMap[imageRounded || 'large'] const align = textAlign === 'center' ? 'text-center' : 'text-left' const media = image as Media return (
{(heading || body) && (
{heading && (

{heading}

)} {body && (

{body}

)}
)} {media?.url && (
{overlay &&
}
)}
) }