Deploy
This commit is contained in:
@@ -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 (
|
||||||
|
<div className="flex justify-center py-16">
|
||||||
|
<div className="w-8 h-8 rounded-full border-2 border-[#0077BE] border-t-transparent animate-spin" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
if (items.length === 0) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="current-offers" data-vula-section="current-offers" data-vula-cms="offers" className="py-20 bg-[#F0F8FF]">
|
||||||
|
<div className="mx-auto max-w-7xl px-4">
|
||||||
|
<div className="max-w-2xl mb-10">
|
||||||
|
<p className="text-sm font-medium text-[#00A8CC] mb-2">Fourways seasonal specials</p>
|
||||||
|
<h2 className="text-3xl font-bold text-[#1A2B3C]">Fresh offers for hair, braids and nails</h2>
|
||||||
|
<p className="mt-3 text-[#1A2B3C]/70">Current promotions change with the season — book soon while spaces last.</p>
|
||||||
|
</div>
|
||||||
|
<div className="grid gap-6 md:grid-cols-2">
|
||||||
|
{items.slice(0, 4).map((item) => {
|
||||||
|
const d = item.data as OfferData
|
||||||
|
const price = formatPrice(d.price)
|
||||||
|
return (
|
||||||
|
<Card key={item.id} className="rounded-xl overflow-hidden bg-white shadow-md flex flex-col md:flex-row">
|
||||||
|
<div className="relative h-48 w-full md:w-1/3 md:min-h-full flex-shrink-0 overflow-hidden">
|
||||||
|
{d.image ? (
|
||||||
|
<Image src={d.image} alt={d.title ?? 'Salon offer'} fill sizes="(max-width: 768px) 100vw, 33vw" className="object-cover" />
|
||||||
|
) : (
|
||||||
|
<div className="h-full w-full bg-[#00A8CC]/20" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<CardContent className="flex-1 p-5">
|
||||||
|
<h3 className="text-xl font-bold text-[#1A2B3C]">{d.title}</h3>
|
||||||
|
<p className="mt-2 text-sm text-[#1A2B3C]/70">{d.description}</p>
|
||||||
|
{(price || d.duration || d.valid_until) && (
|
||||||
|
<div className="mt-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm">
|
||||||
|
{price && <span className="font-semibold text-[#0077BE]">{price}</span>}
|
||||||
|
{d.duration && (
|
||||||
|
<span className="inline-flex items-center gap-1 text-[#1A2B3C]/60">
|
||||||
|
<Clock className="w-4 h-4" /> {d.duration}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{d.valid_until && <span className="text-[#1A2B3C]/60">Valid until {d.valid_until}</span>}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Link href="/services" className="mt-4 inline-flex items-center gap-1 rounded-full bg-[#FFD700] px-5 py-2.5 text-sm font-semibold text-black transition-all duration-200 ease-out hover:bg-[#FFD700]/90">
|
||||||
|
Book this offer <ArrowRight className="w-4 h-4" />
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user