import Image from 'next/image' import Link from 'next/link' import { getAdvertBanners } from '@/lib/cms' export default async function AdvertBannerSection() { const items = await getAdvertBanners() const now = Date.now() const banner = items.find(item => { const start = item.data.start_date ? new Date(item.data.start_date as string).getTime() : 0 const end = item.data.end_date ? new Date(item.data.end_date as string).getTime() : Infinity return now >= start && now <= end }) ?? items[0] if (!banner) return null const { headline, subheadline, cta_text, cta_url, image } = banner.data as { headline: string; subheadline?: string; cta_text?: string; cta_url?: string; image?: string } return (
{image ? (
{headline}

{headline}

{subheadline &&

{subheadline}

} {cta_text && cta_url && ( {cta_text} )}
) : (

{headline}

{subheadline &&

{subheadline}

} {cta_text && cta_url && ( {cta_text} )}
)}
) }