import React from 'react' import type { FDCtaSideImageBlock as FDCtaSideImageBlockProps } from '@/payload-types' import type { Media } from '@/payload-types' import { FDImage } from '@/components/FDImage' import { FDButton } from '@/components/FDButton' /* Priority #5: Responsive radius */ const imageRadius = 'rounded-[32px] md:rounded-[50px] lg:rounded-[70px]' /* Color overlay — same map as FDHeaderTextImageBlock */ 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', } export const FDCtaSideImageBlockComponent: React.FC = ({ heading, body, ctaText, ctaLink = '#', image, imageOverlay = 'none', imagePosition = 'right', theme = 'dark', anchorId, }) => { const isDark = theme === 'dark' const hasImage = !!image const overlay = overlayMap[(imageOverlay as string) || 'none'] || '' // Light theme adapts to OS dark preference → becomes navy bg const sectionBg = isDark ? 'bg-fd-navy' : 'bg-white dark:bg-fd-navy' const headingClass = isDark ? 'text-fd-yellow' : 'text-fd-navy dark:text-fd-yellow' const bodyClass = isDark ? 'text-white' : 'text-fd-navy dark:text-white' // Mobile order is always: heading → image → body → button // Desktop order respects imagePosition (left/right) // We achieve this by splitting heading from body+button and using CSS order const desktopTextOrder = imagePosition === 'left' ? 'min-[820px]:order-2' : 'min-[820px]:order-1' const desktopImageOrder = imagePosition === 'left' ? 'min-[820px]:order-1' : 'min-[820px]:order-2' return (
{/* Heading — always first on mobile */}

{heading}

{/* Image — always second on mobile, position-aware on desktop */} {hasImage && (
{overlay &&
}
)} {/* Text block — heading hidden on mobile (shown above), body+button always third */}
{/* Heading shown only on desktop inside the text column */}

{heading}

{body}

{ctaText && ( {ctaText} )}
) }