mirror of
https://github.com/vercel/commerce.git
synced 2025-06-28 01:11:24 +00:00
33 lines
976 B
TypeScript
33 lines
976 B
TypeScript
import Grid from 'components/grid';
|
|
import { GridTileImage } from 'components/grid/tile';
|
|
import { Product } from 'lib/woocomerce/models/product';
|
|
import Link from 'next/link';
|
|
|
|
export default function ProductGridItems({ products }: { products: Product[] }) {
|
|
return (
|
|
<>
|
|
{products.map((product) => (
|
|
<Grid.Item key={product.id} className="animate-fadeIn">
|
|
<Link
|
|
className="relative inline-block h-full w-full"
|
|
href={`/product/${product.id}`}
|
|
prefetch={true}
|
|
>
|
|
<GridTileImage
|
|
alt={product.name}
|
|
label={{
|
|
title: product.name,
|
|
amount: product.price,
|
|
currencyCode: 'EUR'
|
|
}}
|
|
src={product.images?.[0]?.src || ''}
|
|
fill
|
|
sizes="(min-width: 768px) 33vw, (min-width: 640px) 50vw, 100vw"
|
|
/>
|
|
</Link>
|
|
</Grid.Item>
|
|
))}
|
|
</>
|
|
);
|
|
}
|