diff --git a/src/components/sections/RoomsSection.tsx b/src/components/sections/RoomsSection.tsx new file mode 100644 index 0000000..83954f1 --- /dev/null +++ b/src/components/sections/RoomsSection.tsx @@ -0,0 +1,89 @@ +'use client' + +import Image from "next/image" +import Link from "next/link" +import { useMedusaProducts } from "@/hooks/useMedusaProducts" +import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/Card" +import Button from "@/components/ui/Button" +import Badge from "@/components/ui/Badge" + +export default function RoomsSection() { + const { products: rooms, isLoading } = useMedusaProducts(6) + + const formatPrice = (amount: number, code?: string) => { + const symbols: Record = { kes: "KSh", usd: "$", eur: "\u20ac", gbp: "\u00a3" } + const sym = symbols[(code ?? "").toLowerCase()] ?? (code?.toUpperCase() ?? "") + return `${sym}${(amount / 100).toFixed(2)}` + } + + return ( +
+
+
+
+ + The Suites + +
+

+ Where craft meets comfort +

+

+ Each of our six signature suites is a harmonious fusion of contemporary elegance and handcrafted Maasai detail. +

+
+ + {isLoading ? ( +
+
+
+ ) : ( +
+ {rooms?.slice(0, 6).map((room) => { + const price = room.variants?.[0]?.prices?.[0] + return ( + +
+ {room.title} + {price && ( + + From {formatPrice(price.amount, price.currency_code)} / night + + )} +
+ + {room.title} + + +

{room.description}

+
+ + + + + +
+ ) + })} +
+ )} + +
+ + + +
+
+
+ ) +}