This code snippet uses ChakraUI styling and retrieves images from SanityCMS:
<Box w="500px" h="500px" bg="red">
<Image
src={allArtPieces[0].imageUrl}
alt={allArtPieces[0].title}
width="500px"
height="500px"
/>
</Box>
I'm trying to make the image fill its container while maintaining its original dimensions. I've experimented with setting the image width to 100% and omitting the height style property, but Next Image component requires a declared height. Any suggestions on how I can accomplish this desired functionality?