4
0
forked from crowetic/commerce
commerce/components/layout/product-grid-items.tsx
Tobias Lins 9ea5671579
Don't fail when collections are not found (#996)
* Don't fail when collections are not found

* fix another error
2023-04-26 09:26:52 -05:00

30 lines
943 B
TypeScript

import Grid from 'components/grid';
import { GridTileImage } from 'components/grid/tile';
import { Product } from 'lib/shopify/types';
import Link from 'next/link';
export default function ProductGridItems({ products }: { products: Product[] }) {
return (
<>
{products.map((product) => (
<Grid.Item key={product.handle} className="animate-fadeIn">
<Link className="h-full w-full" href={`/product/${product.handle}`}>
<GridTileImage
alt={product.title}
labels={{
isSmall: true,
title: product.title,
amount: product.priceRange.maxVariantPrice.amount,
currencyCode: product.priceRange.maxVariantPrice.currencyCode
}}
src={product.featuredImage?.url}
width={600}
height={600}
/>
</Link>
</Grid.Item>
))}
</>
);
}