Deploy
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
'use client'
|
||||
|
||||
import { useMedusaProducts } from '@/hooks/useMedusaProducts'
|
||||
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/Card'
|
||||
import Button from '@/components/ui/Button'
|
||||
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 UbuhleSuitesSection() {
|
||||
const { products: rooms, isLoading, error } = useMedusaProducts(6)
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<section data-vula-section="ubuhlesuites" id="ubuhle-suites" className="py-20 bg-[#f9f7f4]">
|
||||
<div className="max-w-7xl mx-auto px-4 text-center">
|
||||
<div className="animate-pulse space-y-4">
|
||||
<div className="h-10 w-64 bg-gray-200 rounded mx-auto" />
|
||||
<div className="h-4 w-96 bg-gray-200 rounded mx-auto" />
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mt-12">
|
||||
{[1,2,3].map(i => <div key={i} className="h-80 bg-gray-200 rounded-2xl" />)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<section id="ubuhle-suites" className="py-20 bg-[#f9f7f4]">
|
||||
<div className="max-w-7xl mx-auto px-4 text-center">
|
||||
<p className="text-[#dc2626] text-lg">Could not load suites. Please try again later.</p>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<section id="ubuhle-suites" className="py-20 bg-[#f9f7f4]">
|
||||
<div className="max-w-7xl mx-auto px-4">
|
||||
<div className="text-center mb-12">
|
||||
<h2 className="text-3xl md:text-4xl font-bold text-[#211c0d] mb-4">Ubuhle Suites — Your Sanctuary in the Wild</h2>
|
||||
<p className="max-w-2xl mx-auto text-[#211c0d]/70 text-lg">
|
||||
Each of our six suites is a canvas of Zulu craftsmanship, quiet luxury, and sweeping views of the KwaZulu-Natal bushveld.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
||||
{rooms?.map((room) => {
|
||||
const variant = room.variants?.[0]
|
||||
const price = variant?.prices?.[0]
|
||||
const imageUrl = room.thumbnail ||
|
||||
'https://images.pexels.com/photos/16436960/pexels-photo-16436960.jpeg?auto=compress&cs=tinysrgb&h=350'
|
||||
|
||||
return (
|
||||
<Card key={room.id} className="rounded-2xl overflow-hidden shadow-lg hover:shadow-xl transition-shadow duration-300 border-0 bg-white">
|
||||
<div className="relative h-56 overflow-hidden">
|
||||
<Image
|
||||
src={imageUrl}
|
||||
alt={room.title}
|
||||
fill
|
||||
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
|
||||
className="object-cover hover:scale-105 transition-transform duration-500 ease-out"
|
||||
/>
|
||||
</div>
|
||||
<CardContent className="p-6">
|
||||
<CardTitle className="text-xl font-semibold text-[#211c0d] mb-2">{room.title}</CardTitle>
|
||||
<p className="text-[#211c0d]/60 text-sm line-clamp-2 mb-4">
|
||||
{room.description || 'A luxurious bush retreat designed for rest and discovery.'}
|
||||
</p>
|
||||
{price && (
|
||||
<p className="text-[#d4af37] font-bold text-lg">
|
||||
{formatPrice(price.amount, price.currency_code)}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
<CardFooter className="px-6 pb-6 pt-0">
|
||||
<Link href={`/booking/${room.id}`}>
|
||||
<Button variant="default" className="w-full bg-[#d4af37] hover:bg-[#c49f2e] text-[#211c0d] font-semibold">
|
||||
Book Now
|
||||
</Button>
|
||||
</Link>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user