diff --git a/components/ui/carousel.tsx b/components/ui/carousel.tsx index 1b7f956ad..a16d2f957 100644 --- a/components/ui/carousel.tsx +++ b/components/ui/carousel.tsx @@ -1,37 +1,58 @@ import { getCollectionProducts } from 'lib/shopify'; +import { getAllLiveProducts } from 'lib/utils'; import Link from 'next/link'; import { GridTileImage } from '../grid/tile'; -export async function Carousel() { +type Collection = 'flower' | 'foliage' | 'nature' | 'urban' | 'sky'; + +export async function Carousel({collection}: + { + collection: Collection | undefined +}) { // Collections that start with `hidden-*` are hidden from the search page. - const products = await getCollectionProducts({ collection: 'hidden-homepage-carousel' }); - console.log("🐡🐠🐬 products", products); + const scapeTitle = collection ? `${collection[0]?.toUpperCase()}${collection.slice(1)}scapes` : ''; + const getProducts = async () => { + return !!collection ? getCollectionProducts({ collection: scapeTitle }) : getAllLiveProducts(); + }; + const products = await getProducts(); if (!products?.length) return null; return ( -
{scapeTitle}
+ + } + {!scapeTitle && + // +All Scapes
+ // + } +