This commit is contained in:
Belen Curcio
2021-01-07 11:19:28 -03:00
parent f7956f8d01
commit 812535caff
3 changed files with 27 additions and 17 deletions

View File

@@ -13,6 +13,7 @@ interface Props {
}
const ProductCard: FC<Props> = ({ className, product, variant, imgProps }) => {
const firstImage = product.images[0]
return (
<a className={cn(s.root, { [s.simple]: variant === 'simple' }, className)}>
{variant === 'slim' ? (
@@ -36,14 +37,16 @@ const ProductCard: FC<Props> = ({ className, product, variant, imgProps }) => {
</div>
</div>
<div className={s.imageContainer}>
<Image
alt={product.name}
className={s.productImage}
src={product.images[0].src}
height={540}
width={540}
{...imgProps}
/>
{firstImage.src && (
<Image
alt={product.name}
className={s.productImage}
src={firstImage.src}
height={540}
width={540}
{...imgProps}
/>
)}
</div>
</>
)}