mukeshsoni / react-photo-grid

Reactjs Component for Facebook like photo/image grids
https://unstack.in/react-photo-grid/
45 stars 12 forks source link

Recalculate on parent resize? #9

Open empz opened 6 years ago

empz commented 6 years ago

Currently the grid doesn't recalculate its size when its parent change their dimension? Is there an easy way to do that?

To clarify, I'm not talking about browser window resizing. I have the grid inside a component that allows to be resized.

mukeshsoni commented 6 years ago

Browser's don't yet support detecting resize events on parent elements. Can the parent element itself detect that it's size has been changed? In that case i can provide a method which will trigger the recalculation of the grid

empz commented 6 years ago

I understand.

Would it be too hard to make the grid use relative units (%) instead of px, so that the grid will resize automatically when the parent resizes? At least only for the total width of the grid so it doesn't overflow outside of its parent.

On Fri, Dec 29, 2017, 13:46 Mukesh Soni notifications@github.com wrote:

Browser's don't yet support detecting resize events on parent elements. Can the parent element itself detect that it's size has been changed? In that case i can provide a method which will trigger the recalculation of the grid

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mukeshsoni/react-photo-grid/issues/9#issuecomment-354469968, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZLSb71rWbawJmZWDyJ9lbkh0q9CWfAks5tFRdcgaJpZM4RPPOO .

mukeshsoni commented 6 years ago

@emzero That looks like a good idea. I wonder if using css-grid makes it even more straight forward and semantic.

empz commented 6 years ago

That sounds like a very good idea but not all browsers support them yet (IE 11). Just using % units will make a huge improvement.

mukeshsoni commented 6 years ago

@anilljoshi Please create a new issue and delete the comment from this thread. This thread is meant for another issue.