-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Masonry] Add new component #27439
[Masonry] Add new component #27439
Conversation
@oliviertassinari I addressed all your comments in #27169 in this commit of this PR: d32d3d5 One thing worth mentioning is that since the images used in https://deploy-preview-27169--material-ui.netlify.app/components/image-list/#standard-image-list all have the same height, they aren't sufficient to showcase the masonry component. So I mixed the current image set with those used in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs page is frozen. First, probably because the images we are loading are likely x10 larger than we need. to, but I also suspect something else completely off with the resize-observer polyfill we are using.
@oliviertassinari I just compared two versions: one using resize event listener and the other using |
@hbjORbj I think that what's important is that if the content of MasonryItem changes, changing its height, then the masonry layout updates, e.g. an image that finishes loading, changing the height of the item. The window resize event won't help much here. |
d32d3d5
to
9d8596b
Compare
@oliviertassinari I allowed |
679d3d8
to
fefd78a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resize observer logic doesn't seem to work:
empty.spot.mp4
Otherwise, it seems that we should focus on the documentation next, and I guess we are done?
ed5c404
to
cec63ac
Compare
e2dab00
to
7a4ddbd
Compare
@oliviertassinari Here is a fix for correctly using ResizeObserver! 7a4ddbd Fix.Resize.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't spot any issues with the behavior, works great. Some comments for polishing, apart from that looks good 🎉
@oliviertassinari how can we improve the visual regresssion tests: https://www.argos-ci.com/mui-org/material-ui/builds/149? They are not really useful at the moment. |
2965f4c
to
d9afcac
Compare
@mnajdova First, I would make Second, I would add a |
@hbjORbj Awesome, now we can focus on the documentation. I would personally propose something in this order, based on the survey, the issue, and the benchmark:
|
f59c1c3
to
c163bb2
Compare
I don't believe we use this format for other components. Please consider standardising - either change this component to match the others, or all others to match this 😉 |
A continuation of #27169
Preview: https://deploy-preview-27439--material-ui.netlify.app/components/masonry/
Closes #17000
1. Problem
A. The items can have arbitrary heights. [Must-have]
B. The next item is pushed to the shortest column. [Must-have]
C. The items should be ordered by row. [Must-have]
D. The number of columns
cols
and the spacing between itemsspacing
can be passed into the component. [Should-have]E. Responsive number of columns (breakpoints) [Nice-to-have]
F. Server side rendering [Nice-to-have]
G. Performance [Nice-to-have]
H. Logical tab order [Should-have]
I. Support for lazy loading/virtualisation [Nice-to-have]
2. Solution
Using CSS Grid + Configuring
grid-row-end
A+
B+
C+
D+
E+
F-
G- (All items must finish loading in order to do computation and apply grid spans to
MasonryItem
s. Currently, I hide all items until document fully loads everything. I think it is a good idea to accept aloader
prop from user and display this loader instead of just hiding items. )H+
I+