-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Post Template: Refactor ad hoc flex container to use layout block support flex type #44557
Comments
Thanks for writing this up! I think the Grid view in Post Template is an ideal candidate for an actual grid layout type. The current implementation is shoehorning grid-like behaviour into a flex layout by forcing a certain number of cols through a complicated width calculation, whereas |
Oh, that's a great idea! I suppose ideally Post Template would support any number of potential future layouts, too (e.g. a future wish-list item might be if layout support winds up eventually allowing for carousel-like behaviour for a Netflix-like scrollable row of post titles 🤔). But yes, I think a grid layout type would be a better fit here, too 👍 |
I would love to see this; i came across this because I'm trying to figure out how to avoid using columns block within the post template block. (running into the issue described at #30480) |
Thanks for adding the screenshot @sophiegyo, that captures the desired goal of this issue perfectly 👍 |
It is awesome to see the movement happening here! Thank you, thank you and another thank you! |
This issue explores different ways to manage image sizes: It should also carry over to the Featured Image block, so that we can have the same cropped size Query Loop featured images. |
Just a quick update: I think it'd still be beneficial to explore our options with the flex layout, and see what kinds of back compat issues we'll run into with enabling different types of layout types on the Post Template block. It sounds like a Grid layout type will be especially useful for this block in the longer term (#47809), but in the shorter-term, it could still be useful to have a play with the flex layout + block spacing and alignment controls. I've started a (very) early PR over in #48340 to have a play and identify what the blockers will be. |
Now that #49050 is merged I'm going to go ahead and close this one. |
The Post Template block currently uses an ad hoc approach to generating flex layout rules for its option for a grid view. This ad hoc approach adds an
is-flex-container
classname, linked to some hard-coded rules in itsstyle.scss
file, here:gutenberg/packages/block-library/src/post-template/style.scss
Line 13 in 6115283
It would be good to refactor the approach of this block to use the layout block support's flex type for the grid styles (
is-layout-flex
), so that we can then directly opt-in toblockGap
support, to allow flexible control over the spacing between instances of the Post Template block.Tasks to address
is-flex-container
rules with the ability to switch between flow / flex layout types using the layout block support (or should this always beflex
, but use vertical orientation as the switch?)width
rules and their calculation so that the ad hoc columns rules still work as-isgap: 1.25em
rule, when making the switchblockGap
controls to allow spacing between instances of the Post Template blockWhy
The overall goal would be to utilise the layout block support for all structural layout styling of this block, so that users can have control over block spacing and content justification, and so that if and when additional layout types are rolled out, these can be used in the Post Template / Query Loop blocks, too, enabling a wider variety of designs.
Related issues (and semi-related issues)
This issue has been touched on already in other feature requests — because those feature requests are typically from the perspective of the user of the theme, I thought it'd be helpful to have a separate issue for tracking the technical issues in implementing those changes. This issue should primarily be for tracking / breaking down the tasks of refactoring away the block's ad hoc layout rules.
The text was updated successfully, but these errors were encountered: