diff --git a/src/components/sections/UrbanCampaignSection.tsx b/src/components/sections/UrbanCampaignSection.tsx new file mode 100644 index 0000000..21e3db3 --- /dev/null +++ b/src/components/sections/UrbanCampaignSection.tsx @@ -0,0 +1,59 @@ +'use client' + +import { useEmDashContent } from '@/hooks/useEmDashContent' +import Image from 'next/image' +import Link from 'next/link' + +const CURRENCY_SYMBOLS: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£', kes: 'KSh', ngn: '₦', ghs: '₵' } +const formatPrice = (amount: number, code?: string) => { + const sym = CURRENCY_SYMBOLS[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '') + return `${sym}${(amount / 100).toFixed(2)}` +} + +export default function UrbanCampaignSection() { + const { items, loading } = useEmDashContent('campaigns') + + if (loading) { + return
+ } + + if (items.length === 0) return null + + return ( +
+
+

Urban Campaign

+
+ {items.map((item) => { + const d = item.data as { title?: string; headline?: string; body?: string; cta_text?: string; image?: string } + return ( +
+ {d.image && ( +
+ {d.headline +
+ )} +
+

{d.title}

+

{d.headline}

+

{d.body}

+ {d.cta_text && ( + + {d.cta_text} + + )} +
+
+ ) + })} +
+
+
+ ) +}