Deploy
This commit is contained in:
@@ -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<string, string> = { 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 <div className="flex justify-center py-16"><div className="w-8 h-8 rounded-full border-2 border-current border-t-transparent animate-spin" /></div>
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items.length === 0) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="urban-campaign" data-vula-section="urbancampaign" data-vula-cms="campaigns" className="py-20 bg-[#ffffff]">
|
||||||
|
<div className="container mx-auto px-4">
|
||||||
|
<h2 className="text-4xl font-bold text-[#111827] mb-12 text-center uppercase tracking-tight">Urban Campaign</h2>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
||||||
|
{items.map((item) => {
|
||||||
|
const d = item.data as { title?: string; headline?: string; body?: string; cta_text?: string; image?: string }
|
||||||
|
return (
|
||||||
|
<div key={item.id} className="group rounded-xl border border-[#e5e7eb] bg-[#ffffff] shadow-[var(--shadow-surface)] hover:shadow-[var(--shadow-lifted)] hover:-translate-y-1 transition-all duration-200 ease-out overflow-hidden">
|
||||||
|
{d.image && (
|
||||||
|
<div className="aspect-[4/3] overflow-hidden">
|
||||||
|
<Image
|
||||||
|
src={d.image}
|
||||||
|
alt={d.headline ?? d.title ?? ''}
|
||||||
|
width={600}
|
||||||
|
height={450}
|
||||||
|
className="object-cover w-full h-full group-hover:scale-105 transition-transform duration-500 ease-out"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="p-5">
|
||||||
|
<h3 className="text-lg font-bold text-[#18181b] mb-1">{d.title}</h3>
|
||||||
|
<p className="text-sm font-semibold text-[#dc2626] uppercase tracking-wider mb-2">{d.headline}</p>
|
||||||
|
<p className="text-[#111827]/70 text-sm leading-relaxed mb-4 line-clamp-3">{d.body}</p>
|
||||||
|
{d.cta_text && (
|
||||||
|
<Link href="/products" className="inline-block px-5 py-2 rounded-lg bg-[#18181b] text-white font-semibold text-sm hover:opacity-90 transition-all duration-200">
|
||||||
|
{d.cta_text}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user