I want to decrease the amount of imageList
columns depending on the display width (a.k.a. media query) but it doesn't work properly.
For example:
<ImageList variant="masonry" cols={{ xl: 3, md: 2, sm: 1 }} gap={18}>
{images.map((image) => (
<ImageListItem key={image.id}>
<img
src={image.urls.regular}
srcSet={image.urls.regular}
alt={image.alt_description}
loading="lazy"
/>
</ImageListItem>
))}
</ImageList>
If I do this, I only get 1 column, and if I try cols={3}
, I get 3 columns. Any tips?