From f6b0347185f8e03820cfdb8899f53ebe11825a55 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Mon, 27 Jul 2026 17:52:36 +0000 Subject: [PATCH] Deploy --- .../sections/MzansiFeaturedSection.tsx | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/components/sections/MzansiFeaturedSection.tsx diff --git a/src/components/sections/MzansiFeaturedSection.tsx b/src/components/sections/MzansiFeaturedSection.tsx new file mode 100644 index 0000000..3bc7a14 --- /dev/null +++ b/src/components/sections/MzansiFeaturedSection.tsx @@ -0,0 +1,93 @@ +'use client' + +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { useMedusaCart } from '@/hooks/useMedusaCart' +import Link from 'next/link' +import Image from 'next/image' +import Button from '@/components/ui/Button' +import Badge from '@/components/ui/Badge' +import { Card, CardContent, CardFooter } from '@/components/ui/Card' + +export default function MzansiFeaturedSection() { + const { products, isLoading } = useMedusaProducts(8) + const { addToCart } = useMedusaCart() + + if (isLoading) { + return ( +
+
+
+ ) + } + + if (products.length === 0) return null + + 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)}` + } + + const handleAddToCart = (variantId: string) => { + addToCart(variantId, 1) + window.dispatchEvent(new CustomEvent('cart-drawer-open')) + } + + return ( + + ) +} \ No newline at end of file