import Grid from 'components/grid'; import { getCollection, getMetaobjects, getMetaobjectsByIds } from 'lib/shopify'; import { Metaobject } from 'lib/shopify/types'; import { Suspense } from 'react'; import ImageDisplay from './image-display'; import { computeLayoutClassnames } from './layout'; export const Category = async ({ collectionId }: { collectionId: string }) => { const collection = await getCollection({ id: collectionId }); return (

{collection?.title}

); }; const CategoryPreview = async ({ block }: { block: Metaobject }) => { const [contentBlocks, layouts, screenSizes] = await Promise.all([ getMetaobjectsByIds(block.categories ? JSON.parse(block.categories) : []), getMetaobjectsByIds(block.layout ? JSON.parse(block.layout) : []), getMetaobjects('screen_sizes') ]); const validClassnames = computeLayoutClassnames({ layouts, screenSizes }); return ( <>

{block.title}

{contentBlocks.map((contentBlock) => (
))}
); }; export const CategoryPreviewPlaceholder = () => { return (
); }; export default CategoryPreview;