commerce/components/layout/product-grid-items.tsx
2024-12-26 21:35:53 +01:00

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>
))}
</>
);
}