I'm trying to implement an image grid like in AirBnB with Next JS. so I'm Using Next Image with responsive layout. but i wanted to make the image square. meaning the height and width should be the same. but when in responsive layout the image is set with it's original size. i even tried to make the object fit cover.
<div className="relative flex flex-col -z-10">
<Image
src={"/profile.webp"}
layout="responsive"
objectFit="cover"
height={100}
width={100}
/>
</div>
how can i achieve that?
this is the code that worked for me, if anyone looks for this maybe it will be useful.