import React from 'react' import type { FDLocationsGridBlock as Props, Media } from '@/payload-types' export const FDLocationsGridBlockComponent: React.FC = ({ heading, description, ctaText, ctaLink = '/kontakt', cards = [], hoverColor = 'navy', sectionBackground = 'white', }) => { const bgClass = sectionBackground === 'navy' ? 'bg-fd-navy' : sectionBackground === 'gray' ? 'bg-fd-gray-light dark:bg-fd-navy' : 'bg-white dark:bg-fd-navy' const titleClass = sectionBackground === 'navy' ? 'text-fd-yellow' : 'text-fd-navy dark:text-fd-yellow' const bodyClass = sectionBackground === 'navy' ? 'text-white' : 'text-fd-navy dark:text-white' const hoverBgClass = hoverColor === 'yellow' ? 'bg-fd-yellow' : hoverColor === 'mint' ? 'bg-fd-mint' : 'bg-fd-navy' const hoverTextClass = hoverColor === 'yellow' ? 'text-fd-navy' : hoverColor === 'mint' ? 'text-fd-navy' : 'text-white' return (
{(heading || description || ctaText) && (
{heading && (

{heading}

)}
{description && (

{description}

)} {ctaText && ( {ctaText} → )}
)}
{(cards ?? []).map((card, i) => { const media = card.image as Media | undefined const isLink = Boolean(card.link) const className = `group relative overflow-hidden rounded-[30px] md:rounded-[50px] aspect-[4/3] block ${isLink ? 'cursor-pointer' : ''}` const inner = ( <> {media?.url && ( {(media )}
{card.locationName}
{card.locationName} {card.address && ( {card.address} )} {card.link && ( → Se mer )}
) return isLink ? ( {inner} ) : (
{inner}
) })}
) }