diff --git a/src/components/sections/IndigenousBotanicalsFeaturedSection.tsx b/src/components/sections/IndigenousBotanicalsFeaturedSection.tsx new file mode 100644 index 0000000..913e815 --- /dev/null +++ b/src/components/sections/IndigenousBotanicalsFeaturedSection.tsx @@ -0,0 +1,68 @@ +'use client' +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { useMedusaCart } from '@/hooks/useMedusaCart' +import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/Card' +import Button from '@/components/ui/Button' +import Image from 'next/image' +import Link from 'next/link' +import { ShoppingBag } from 'lucide-react' + +export default function IndigenousBotanicalsFeaturedSection() { + const { products, isLoading } = useMedusaProducts(8) + const { addToCart } = useMedusaCart() + + const formatPrice = (amount: number, code?: string) => { + const symbols: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£', kes: 'KSh', ngn: '₦', ghs: '₵' } + const sym = symbols[(code ?? '').toLowerCase()] ?? (code?.toUpperCase() ?? '') + return `${sym}${(amount / 100).toFixed(2)}` + } + + if (isLoading) return
+ if (!products || products.length === 0) return null + + const handleAddToCart = (variantId: string) => { + addToCart(variantId, 1) + window.dispatchEvent(new CustomEvent('cart-drawer-open')) + } + + return ( +
+
+
+

Ubuhle Bendalo

+

Indigenous Botanicals

+

Handpicked from the wild – marula, rooibos, buchu – each jar tells a story of African earth.

+
+
+ {products.slice(0, 8).map((product) => { + const variant = product.variants?.[0] + const price = variant?.prices?.[0] + const imgSrc = product.thumbnail || '/placeholder-product.svg' + return ( + + + {product.title} + + + +

{product.title}

+ + {price && ( +

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

+ )} +
+ + {variant && ( + + )} + +
+ ) + })} +
+
+
+ ) +} \ No newline at end of file