Skip to content
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

Gallery Block: Try masonry layout option #4734

Closed
wants to merge 1 commit into from

Conversation

jasmussen
Copy link
Contributor

This PR adds a "masonry layout" option to the gallery block inspector. Toggling this will let you show your gallery in a masonry style layout instead of the default one. "Masonry" refers to having either the width or the height vary, yet laying out items so items fit snugly edge to edge.

GIF:

masonry

This PR is unfinished. The masonry option isn't saved yet, and as a result the frontend styles don't output. Also, the crop feature is tied to the default style of the gallery, so we'd probably want to "gray" the crop option if you choose the masonry option. But it works in the editor, so you can try it.

Before I do any work to polish this any more, the question is: do we want this feature as part of the stock gallery, or should this be left to plugins to build?

This PR adds a "masonry layout" option to the gallery block inspector. Toggling this will let you show your gallery in a masonry style layout instead of the default one.
@jasmussen jasmussen added [Feature] Blocks Overall functionality of blocks [Status] In Progress Tracking issues with work in progress Needs Design Feedback Needs general design feedback. labels Jan 29, 2018
@jasmussen jasmussen self-assigned this Jan 29, 2018
@andreiglingeanu
Copy link
Contributor

andreiglingeanu commented Jan 29, 2018

It all sounds very cool but column-* CSS properties do not fit very well for complex masonry layouts (they're purpose is to align text in columns, really), here's an issue that tracks this particular layout, but for CSS Grid instead: rachelandrew/cssgrid-ama#19

Another option is to use @desandro's masonry lib, but I believe that's too big a dependency for Gutenberg.

@jasmussen
Copy link
Contributor Author

Great discussion. Per thoughts also in #4771 (comment), for now I'm, going to close this as "plugin territory".

However in #4771 I'm going to post some CSS that combined with the "additional CSS class" will make it easy for anyone to convert a gallery to a masonry gallery.

@jasmussen jasmussen closed this Jan 31, 2018
@jasmussen jasmussen deleted the add/gallery-masonry-option branch January 31, 2018 09:11
@desandro
Copy link

I've also got a smaller library that does Masonry layouts that's 10% the size of Masonry called Colcade. It doesn't have a lot of usage, so you'd be really throwing it into the spotlight. But it might be the right solution for this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks Needs Design Feedback Needs general design feedback. [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants