In following Next.js Component i want to add hover effects to the .itemCard and the button only. Those two must have diffent hover effects. (ex- itemcard will have a box-shadow effect and the button will have a backgroud color change). I have tried pinter-events:none in various ways but had no luck.
const Img = (props: imgProps) => {
return (
<div className={styles.itemCard}>
<div className={styles.imagecontainer}>
<div className={styles.imageOuter}>
<img className={styles.imageItself} src={props.img} alt="" />
</div>
<div className={styles.details}>
<h3 className={styles.titleCardHome}>{props.title}</h3>
<p className={styles.description}>Lorem ipsum dolor sit amet consectetur.</p>
<p className={styles.priceHome}>{props.price}</p>
<button className={styles.btncartAdd}>Add to Cart</button>
</div>
</div>
</div>
);
};
Here is my janky CSS:
.itemCard {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
max-width: 20rem;
min-width: 15rem;
background-color: rgba(255, 255, 255, 0);
border-radius: 5px;
margin: 10px;
transition: .3s;
transition: transform 0.3s ease-in-out;
}
.imagecontainer {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
max-width: 20rem;
min-width: 15rem;
background-color: rgb(234, 202, 117);
border-radius: 5px;
margin: 20px;
transition: .3s;
transition: transform 0.3s ease-in-out;
box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.139);
}
.imagecontainer .imageOuter {
max-height: 60%;
min-height: 60%;
width: 100%;
background-color: antiquewhite;
}
.imagecontainer .imageOuter img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 5px 5px 0px 0px;
pointer-events: none;
}
.itemCard :not(.btncartAdd):hover{
transition: transform 0.3s ease-in-out;
/* transform: scale(1.01); */
transition: .3s;
box-shadow: 0px 10px 17px rgba(0, 0, 0, 0.214);
}
.details :not(.btncartAdd) {
pointer-events: none;
}
.itemCard
.details {
font-family: 'Courier New', Courier, monospace;
display: flex;
flex-direction: column;
margin: -50px 5px -30px 5px;
background-color: rgb(254, 229, 160);
box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.067);
width: 100%;
height: 8rem;
border-radius: 5px;
padding: 10px;
}
.details .btncartAdd {
background-color: rgb(223, 84, 20);
border: none;
width: 100%;
padding: 5px;
margin-top: 10px;
color: white;
border-radius: 5px;
}
how to achieve this?