cedricdelpoux / react-responsive-masonry

React responsive masonry component built with css flexbox
https://cedricdelpoux.github.io/react-responsive-masonry/
MIT License
353 stars 35 forks source link

make align columns #114

Closed amird308 closed 3 months ago

amird308 commented 9 months ago

a little feature for make align columns

amird308 commented 9 months ago
<Masonry alignColumns={true} columnsCount={3} gutter="10px">
          {images.map((image, i) => (
            <img
              key={i}
              src={image}
              // set height of style form heights array randomly
              style={{width: "100%", display: "block", height: [number]}}
            />
          ))}
        </Masonry>

now you have align columns

amird308 commented 9 months ago

If you have a few images that are taller than others, like this case: alignColumns can help us.

Screenshot 2023-10-29 at 3 30 35 PM

without alignColumns:

Screenshot 2023-10-29 at 3 31 13 PM

with alignColumns:

Screenshot 2023-10-29 at 3 30 47 PM

Amit-Dagar commented 7 months ago

what if someone doesn't have height data with images ?

gabrielmicko commented 5 months ago

If I see it correctly, this library does not calculate the height of each children, but rather just splits children equally into separate columns. Probably this works for most of the people, but not for me. I end up with large column differences.

cedricdelpoux commented 5 months ago

Sorry, I missed your PR. Could you rebase? I will merge and publish it. Thanks

amird308 commented 5 months ago

Sorry, I missed your PR. Could you rebase? I will merge and publish it. Thanks

`

cedricdelpoux commented 4 months ago

@amird308 There are still conflicts and I can't merge. Could you rebase please?