diff --git a/src/components/sections/CurrentOffersSection.tsx b/src/components/sections/CurrentOffersSection.tsx new file mode 100644 index 0000000..a22138b --- /dev/null +++ b/src/components/sections/CurrentOffersSection.tsx @@ -0,0 +1,81 @@ +'use client' + +import Image from 'next/image' +import Link from 'next/link' +import { Card, CardContent } from '@/components/ui/Card' +import { useVulaContent } from '@/hooks/useVulaContent' +import { ArrowRight, Clock } from 'lucide-react' + +interface OfferData { + title?: string + description?: string + price?: number | string + duration?: string + valid_until?: string + image?: string | null +} + +const formatPrice = (price?: number | string) => { + if (typeof price === 'number') return `R${price.toFixed(2)}` + if (typeof price === 'string' && price.trim()) return price.startsWith('R') ? price : `R${price}` + return '' +} + +export default function CurrentOffersSection() { + const { items, loading } = useVulaContent('offers') + + if (loading) return ( +
+
+
+ ) + + if (items.length === 0) return null + + return ( +
+
+
+

Fourways seasonal specials

+

Fresh offers for hair, braids and nails

+

Current promotions change with the season — book soon while spaces last.

+
+
+ {items.slice(0, 4).map((item) => { + const d = item.data as OfferData + const price = formatPrice(d.price) + return ( + +
+ {d.image ? ( + {d.title + ) : ( +
+ )} +
+ +

{d.title}

+

{d.description}

+ {(price || d.duration || d.valid_until) && ( +
+ {price && {price}} + {d.duration && ( + + {d.duration} + + )} + {d.valid_until && Valid until {d.valid_until}} +
+ )} + + Book this offer + +
+ + ) + })} +
+
+
+ ) +} \ No newline at end of file