mirror of
https://github.com/vercel/commerce.git
synced 2025-03-14 14:42:31 +00:00
improve image component styles
This commit is contained in:
parent
037de93e65
commit
695a446314
14
components/core/EnhancedImage/EnhancedImage.module.css
Normal file
14
components/core/EnhancedImage/EnhancedImage.module.css
Normal file
@ -0,0 +1,14 @@
|
||||
.root {
|
||||
@apply transform transition-transform duration-500;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
& div {
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { FC } from 'react'
|
||||
import { useInView } from 'react-intersection-observer'
|
||||
import Image from 'next/image'
|
||||
import s from './EnhancedImage.module.css'
|
||||
|
||||
type Props = Omit<
|
||||
JSX.IntrinsicElements['img'],
|
||||
@ -33,7 +34,7 @@ const EnhancedImage: FC<Props & JSX.IntrinsicElements['img']> = ({
|
||||
})
|
||||
|
||||
return (
|
||||
<div ref={ref}>
|
||||
<div ref={ref} className={s.root}>
|
||||
<Image {...props} />
|
||||
</div>
|
||||
)
|
||||
|
@ -122,9 +122,3 @@
|
||||
.wishlistButton {
|
||||
@apply w-10 h-10 flex ml-auto items-center justify-center bg-primary text-primary font-semibold text-xs leading-6 cursor-pointer;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -70,17 +70,15 @@ const ProductCard: FC<Props> = ({
|
||||
variant={p.variants.edges?.[0]!}
|
||||
/>
|
||||
</div>
|
||||
<div className={cn(s.imageContainer)}>
|
||||
<EnhancedImage
|
||||
alt={p.name}
|
||||
className={cn('w-full object-cover', s['product-image'])}
|
||||
src={src}
|
||||
width={imgWidth}
|
||||
height={imgHeight}
|
||||
priority={priority}
|
||||
quality="90"
|
||||
/>
|
||||
</div>
|
||||
<EnhancedImage
|
||||
alt={p.name}
|
||||
className="w-full object-cover"
|
||||
src={src}
|
||||
width={imgWidth}
|
||||
height={imgHeight}
|
||||
priority={priority}
|
||||
quality="90"
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user