import React from 'react' import type { FDTextBlock as FDTextBlockProps } from '@/payload-types' import RichText from '@/components/RichText' const bgMap: Record = { white: 'bg-white', navy: 'bg-fd-navy', gray: 'bg-fd-gray-light', yellow: 'bg-fd-yellow', } const alignMap: Record = { left: 'text-left', center: 'text-center', right: 'text-right', } const maxWidthMap: Record = { narrow: 'max-w-[600px]', medium: 'max-w-[800px]', wide: 'max-w-[1100px]', full: '', } const textColorMap: Record = { navy: { h1: 'text-fd-navy', h2: 'text-fd-navy', body: 'text-fd-navy' }, white: { h1: 'text-white', h2: 'text-white', body: 'text-white/90' }, yellow: { h1: 'text-fd-yellow', h2: 'text-fd-yellow', body: 'text-fd-yellow/90' }, } export const FDTextBlockComponent: React.FC = ({ heading, subheading, body, alignment = 'left', textColor = 'navy', sectionBackground = 'white', maxWidth = 'wide', }) => { const bg = bgMap[sectionBackground || 'white'] const align = alignMap[alignment || 'left'] const width = maxWidthMap[maxWidth || 'wide'] const colors = textColorMap[textColor || 'navy'] const containerAlign = alignment === 'center' ? 'mx-auto' : alignment === 'right' ? 'ml-auto' : '' if (!heading && !subheading && !body) return null return (
{heading && (

{heading}

)} {subheading && (

{subheading}

)} {body && (
)}
) }