import { getCollectionProducts } from 'lib/shopify'; import { getAllLiveProducts } from 'lib/utils'; import Link from 'next/link'; import { GridTileImage } from '../grid/tile'; 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 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}

} {!scapeTitle && //

All Scapes

// }
{[...products, ...products].map((product, i) => ( ))}
); }