Show featured items on homepage even if there are <3

This commit is contained in:
Samantha Kellow 2023-07-26 20:42:44 +01:00
parent 58921729ae
commit 72c8855edc

View File

@ -33,15 +33,15 @@ export async function ThreeItemGrid() {
collection: 'hidden-homepage-featured-items' collection: 'hidden-homepage-featured-items'
}); });
if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null; // if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null;
const [firstProduct, secondProduct, thirdProduct] = homepageItems; const [firstProduct, secondProduct, thirdProduct] = homepageItems;
return ( return (
<section className="mx-auto grid max-w-screen-2xl gap-4 px-4 pb-4 lg:grid-cols-6 lg:grid-rows-2"> <section className="mx-auto grid max-w-screen-2xl gap-4 px-4 pb-4 lg:grid-cols-6 lg:grid-rows-2">
<ThreeItemGridItem size="full" item={firstProduct} /> {firstProduct && <ThreeItemGridItem size="full" item={firstProduct} />}
<ThreeItemGridItem size="half" item={secondProduct} /> {secondProduct && <ThreeItemGridItem size="half" item={secondProduct} />}
<ThreeItemGridItem size="half" item={thirdProduct} /> {thirdProduct && <ThreeItemGridItem size="half" item={thirdProduct} />}
</section> </section>
); );
} }