From 044b4368d514ce174cdbe2b242e40914a45543f7 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Mon, 27 Jul 2026 18:59:56 +0000 Subject: [PATCH] Deploy --- .../sections/NewArrivalsSection.tsx | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/components/sections/NewArrivalsSection.tsx diff --git a/src/components/sections/NewArrivalsSection.tsx b/src/components/sections/NewArrivalsSection.tsx new file mode 100644 index 0000000..cc6e3a4 --- /dev/null +++ b/src/components/sections/NewArrivalsSection.tsx @@ -0,0 +1,72 @@ +'use client' + +import { useMedusaProducts } from "@/hooks/useMedusaProducts" +import { Card, CardContent } from "@/components/ui/Card" +import Badge from "@/components/ui/Badge" +import Link from "next/link" + +const CURRENCY_SYMBOLS: Record = { 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 NewArrivalsSection() { + const { products, isLoading } = useMedusaProducts(6) + + if (isLoading) { + return ( +
+
+
+ ) + } + + if (!products || products.length === 0) return null + + return ( +
+
+

+ JUST LANDED +

+

+ Fresh drops from Soweto's finest +

+
+ {products.map((product) => { + const price = product.variants?.[0]?.prices?.[0] + const formattedPrice = price + ? formatPrice(price.amount, price.currency_code) + : "—" + return ( + + +
+ {product.title} +
+ +

+ {product.title} +

+

+ {formattedPrice} +

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