forked from crowetic/commerce
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 { FC } from 'react'
|
||||||
import { useInView } from 'react-intersection-observer'
|
import { useInView } from 'react-intersection-observer'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
|
import s from './EnhancedImage.module.css'
|
||||||
|
|
||||||
type Props = Omit<
|
type Props = Omit<
|
||||||
JSX.IntrinsicElements['img'],
|
JSX.IntrinsicElements['img'],
|
||||||
@ -33,7 +34,7 @@ const EnhancedImage: FC<Props & JSX.IntrinsicElements['img']> = ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={ref}>
|
<div ref={ref} className={s.root}>
|
||||||
<Image {...props} />
|
<Image {...props} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -122,9 +122,3 @@
|
|||||||
.wishlistButton {
|
.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;
|
@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]!}
|
variant={p.variants.edges?.[0]!}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={cn(s.imageContainer)}>
|
|
||||||
<EnhancedImage
|
<EnhancedImage
|
||||||
alt={p.name}
|
alt={p.name}
|
||||||
className={cn('w-full object-cover', s['product-image'])}
|
className="w-full object-cover"
|
||||||
src={src}
|
src={src}
|
||||||
width={imgWidth}
|
width={imgWidth}
|
||||||
height={imgHeight}
|
height={imgHeight}
|
||||||
priority={priority}
|
priority={priority}
|
||||||
quality="90"
|
quality="90"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user