From 32dac2c49feda3b0746aa030e7d073e76c81e1f5 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Mon, 27 Jul 2026 17:52:35 +0000 Subject: [PATCH] Deploy --- .../sections/BrandCarouselSection.tsx | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/components/sections/BrandCarouselSection.tsx diff --git a/src/components/sections/BrandCarouselSection.tsx b/src/components/sections/BrandCarouselSection.tsx new file mode 100644 index 0000000..4902000 --- /dev/null +++ b/src/components/sections/BrandCarouselSection.tsx @@ -0,0 +1,48 @@ +'use client' +import { useEffect, useState } from 'react' +import Link from 'next/link' +import Image from 'next/image' + +interface MedusaCollection { id: string; title: string; handle: string; metadata?: { image?: string } } + +export default function BrandCarouselSection() { + const [collections, setCollections] = useState([]) + const [loading, setLoading] = useState(true) + + useEffect(() => { + fetch('/api/medusa/store/collections?limit=20') + .then(r => r.ok ? r.json() : Promise.reject()) + .then(d => { setCollections(d.collections ?? []); setLoading(false) }) + .catch(() => setLoading(false)) + }, []) + + if (loading || collections.length === 0) return null + + return ( +
+
+

Shop by Collection

+
+ {collections.map(col => ( + +
+ {col.metadata?.image ? ( + {col.title} + ) : ( +
+ {col.title.slice(0, 2)} +
+ )} +
+

{col.title}

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