mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 16:07:01 +00:00
home: add product image hover state
This commit is contained in:
parent
29c3662daf
commit
d5f8c6633e
@ -23,12 +23,15 @@ export async function HomeProduct({ product }) {
|
||||
className={styles.homeProduct}
|
||||
>
|
||||
{/* TODO: optimize srcset (adjusting based on featured status) */}
|
||||
<Image
|
||||
src={featuredImage?.url}
|
||||
alt={featuredImage?.altText}
|
||||
width={featuredImage?.width}
|
||||
height={featuredImage?.height}
|
||||
/>
|
||||
<div className={styles.image}>
|
||||
<Image
|
||||
src={featuredImage?.url}
|
||||
alt={featuredImage?.altText}
|
||||
width={featuredImage?.width}
|
||||
height={featuredImage?.height}
|
||||
/>
|
||||
<div className={styles.hoverOverlay} />
|
||||
</div>
|
||||
<div>
|
||||
<p className={styles.title}>{product?.title}</p>
|
||||
{collections && collections.length > 0 && (
|
||||
|
@ -1,5 +1,6 @@
|
||||
@use 'styles/_typography';
|
||||
@use 'styles/_spacing';
|
||||
@use 'styles/_colors';
|
||||
|
||||
@mixin home-grid {
|
||||
display: grid;
|
||||
@ -73,6 +74,36 @@
|
||||
.collections {
|
||||
@include typography.subheader;
|
||||
}
|
||||
|
||||
.image {
|
||||
position: relative;
|
||||
|
||||
.hoverOverlay,
|
||||
img {
|
||||
transition: opacity 200ms;
|
||||
}
|
||||
|
||||
.hoverOverlay {
|
||||
background-color: colors.$black;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.hoverOverlay {
|
||||
opacity: 1;
|
||||
}
|
||||
img {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.homeFooter {
|
||||
|
Loading…
x
Reference in New Issue
Block a user