From c477089abd4b572fd8bdb4b0a2c288a7e749cf62 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Tue, 28 Jul 2026 07:32:30 +0000 Subject: [PATCH] Deploy --- .../sections/BotanicalTreasuresSection.tsx | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/components/sections/BotanicalTreasuresSection.tsx diff --git a/src/components/sections/BotanicalTreasuresSection.tsx b/src/components/sections/BotanicalTreasuresSection.tsx new file mode 100644 index 0000000..a30903b --- /dev/null +++ b/src/components/sections/BotanicalTreasuresSection.tsx @@ -0,0 +1,83 @@ +'use client' + +import { useMedusaProducts } from '@/hooks/useMedusaProducts' +import { useMedusaCart } from '@/hooks/useMedusaCart' +import { Card, CardContent, CardFooter } from '@/components/ui/Card' +import Button from '@/components/ui/Button' +import Badge from '@/components/ui/Badge' +import Image from 'next/image' +import Link from 'next/link' + +const formatPrice = (amount: number, code?: string) => { + const sym: Record = { zar: 'R', usd: '$', eur: '€', gbp: '£' } + const s = sym[(code || '').toLowerCase()] || (code || '').toUpperCase() + return `${s}${(amount / 100).toFixed(2)}` +} + +export default function BotanicalTreasuresSection() { + const { products, isLoading, error } = useMedusaProducts(8) + const { addToCart } = useMedusaCart() + + if (isLoading) return
+ if (error) return null + if (!products || products.length === 0) return null + + const handleQuickAdd = (variantId: string) => { + addToCart(variantId, 1) + window.dispatchEvent(new CustomEvent('cart-drawer-open')) + } + + return ( +
+
+
+

Botanical Treasures

+

Eight small-batch essentials cold-pressed with ancestral care

+
+
+ {products.slice(0, 8).map((product) => { + const variant = product.variants?.[0] + const price = variant?.prices?.[0] + return ( + + +
+ {product.thumbnail ? ( + {product.title} + ) : ( +
+ +
+ )} + {product.tags?.includes('best-seller') && ( + Best Seller + )} +
+ + +

{product.title}

+ {price && ( +

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

+ )} +
+ + + +
+ ) + })} +
+
+
+ ) +} \ No newline at end of file