diff --git a/src/components/sections/VendaHeritageRoomsSection.tsx b/src/components/sections/VendaHeritageRoomsSection.tsx new file mode 100644 index 0000000..2063b15 --- /dev/null +++ b/src/components/sections/VendaHeritageRoomsSection.tsx @@ -0,0 +1,88 @@ +'use client' + +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@/components/ui/Card' +import Button from '@/components/ui/Button' +import Link from 'next/link' +import Image from 'next/image' + +export default function VendaHeritageRoomsSection() { + const { products: rooms, isLoading, error } = useMedusaProducts(6) + + const CURRENCY_SYMBOLS: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£' } + const formatPrice = (amount: number, code?: string) => { + const sym = CURRENCY_SYMBOLS[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '') + return `${sym}${(amount / 100).toFixed(2)}` + } + + if (isLoading) { + return ( +
+
+

Loading rooms...

+
+
+ ) + } + + if (error) { + return ( +
+
+

Could not load rooms. Please try again later.

+
+
+ ) + } + + return ( +
+
+

+ Six Rooms, Each a Home +

+

+ Named after Venda fruit trees — Muvhuyu, Murula, Muumo — each room weaves handcrafted decor with local tradition. +

+
+ {rooms && rooms.length > 0 ? rooms.map((room: any) => { + const price = room.variants?.[0]?.prices?.[0] + return ( + +
+ {room.title} +
+ + {room.title} + + +

{room.description}

+ {price && ( +

+ {formatPrice(price.amount, price.currency_code)} / night +

+ )} +
+ + + + + +
+ ) + }) : ( +

No rooms available yet. Check back soon.

+ )} +
+
+
+ ) +} \ No newline at end of file