This commit is contained in:
Bel Curcio
2021-05-31 18:00:55 -03:00
parent 96836b1969
commit 025a89bc73
6 changed files with 85 additions and 55 deletions

View File

@@ -11,6 +11,7 @@ interface Props {
product: Product
variant?: 'slim' | 'simple'
imgProps?: Omit<ImageProps, 'src'>
noNameTag: boolean
}
const placeholderImg = '/product-img-placeholder.svg'
@@ -20,17 +21,20 @@ const ProductCard: FC<Props> = ({
product,
variant,
imgProps,
noNameTag = false,
...props
}) => (
<Link href={`/product/${product.slug}`} {...props}>
<a className={cn(s.root, { [s.simple]: variant === 'simple' }, className)}>
{variant === 'slim' ? (
<div className="relative overflow-hidden box-border">
<div className="absolute inset-0 flex items-center justify-end mr-8 z-20">
<span className="bg-black text-white inline-block p-3 font-bold text-xl break-words">
{product.name}
</span>
</div>
<div className="relative overflow-hidden box-border ">
{!noNameTag && (
<div className="absolute inset-0 flex items-center justify-end mr-8 z-20">
<span className="bg-black text-white inline-block p-3 font-bold text-xl break-words">
{product.name}
</span>
</div>
)}
{product?.images && (
<Image
quality="85"
@@ -46,17 +50,19 @@ const ProductCard: FC<Props> = ({
) : (
<>
<div className={s.squareBg} />
<div className="flex flex-row justify-between box-border w-full z-20 absolute">
<div className="absolute top-0 left-0 pr-16 max-w-full">
<h3 className={s.productTitle}>
<span>{product.name}</span>
</h3>
<span className={s.productPrice}>
{product.price.value}
&nbsp;
{product.price.currencyCode}
</span>
</div>
<div className="flex flex-row justify-between box-border w-full z-20 absolute bg-red">
{!noNameTag && (
<div className="absolute top-0 left-0 pr-16 max-w-full">
<h3 className={s.productTitle}>
<span>{product.name}</span>
</h3>
<span className={s.productPrice}>
{product.price.value}
&nbsp;
{product.price.currencyCode}
</span>
</div>
)}
{process.env.COMMERCE_WISHLIST_ENABLED && (
<WishlistButton
className={s.wishlistButton}