From 36ef76313df2609a8109fe9afaa08545e1cef091 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Tue, 23 Jun 2026 08:39:05 +0000 Subject: [PATCH] Deploy --- .../sections/NewArrivalsSection.tsx | 100 ++++++++++++++++++ 1 file changed, 100 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..42b5a98 --- /dev/null +++ b/src/components/sections/NewArrivalsSection.tsx @@ -0,0 +1,100 @@ +'use client' + +import Link from "next/link" +import { useMedusaProducts } from "@/hooks/useMedusaProducts" +import { Card, CardContent } from "@/components/ui/Card" + +const CURRENCY_SYMBOLS: Record = { + zar: "R", + usd: "$", + eur: "\u20AC", + gbp: "\u00A3", +} + +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(4) + + return ( +
+
+
+

+ New Arrivals +

+

+ Fresh drops straight from production +

+
+ + {isLoading && ( +
+ {[...Array(4)].map((_, i) => ( +
+
+
+
+
+
+
+ ))} +
+ )} + + {!isLoading && ( +
+ {products?.slice(0, 4).map((product) => { + const price = product.variants?.[0]?.prices?.[0] + return ( + + +
+ {product.thumbnail ? ( + {product.title} + ) : ( +
+ T +
+ )} +
+ +

+ {product.title} +

+ {price && ( +

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

+ )} +
+
+ + ) + })} +
+ )} + +
+ + Shop All New Drops + +
+
+
+ ) +}