-
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
[Block: Group] Add transform to row variation #36202
Conversation
Size Change: +1.66 kB (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
f46a4d5
to
88f7536
Compare
Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
c1a0fce
to
bc08272
Compare
attributes: { layout: { type: 'default' } }, | ||
scope: [ 'transform' ], | ||
isActive: ( blockAttributes ) => | ||
blockAttributes.layout?.type === 'default', |
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.
When we insert a group block, it's not checked because an undefined layout is also a "group" block. So we should add ! blockAttributes.layout || blockAttributes.layout?.type === 'default'
here
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.
This works great for me.
It made me wonder whether the variation switcher should be just merged with the regular block switcher (the UI to transform to other blocks) instead of being its own thing.
@ndiego had similar questions a few ago, this is the explanation I could find in GitHub archives - #25231 (comment) |
I think that's totally possible, for me the main "pro" of having a different variation is surfacing a "row" in the inserter. Once inserter it matters less whether you should switch on the sidebar or using a variation transform. |
Absolutely. It's also a good term to use in conversation around site building. Assuming it's possible, it would be good for any design exercises to consider whether we then need both the direction switcher, and the transforms interface between the two, at least in terms of managing prominence. |
@jasmussen I also wanted to clarify that switching between "flex" and "default" layout is not a "direction" switching even if it looks like that. It has more impact than that:
For this reason and even if we keep a layout switcher in the block inspector directly, I'm not sure it should be advertised as "direction". |
Not suggesting the following, but just in terms of understanding:
|
In some ways, I kinda wish the Row block was it's own block and not a variation of the Group block. It is actually quite different and then a normal block transformation could be done between the two. For example, the "Inherit default layout" selector exists on Row blocks, but shouldn't since it's a flex container. Also, when that setting is enabled it turns the block back into a normal Group block. I think the ship has sailed on this, but having the Row block be its own block would have probably been the easiest scenario. |
@jasmussen Indeed we do have "orientation" support in the "flex" layout directly. So we have:
|
Right, so "Row" could have the orientation switcher as a way to get to the "Column", perhaps? Just thinking out loud at this point, and it'd generally seem best to abstract the terminology away since they're all just containers with properties. |
@jasmussen yes, the orientation switcher is there but hidden :P |
To avoid blocking this PR which is indeed a nice feature. Can we do this:
|
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.
LGTM 👍
Description
Makes it possible to transform a group into a row variation and vice versa.
For #35355
How has this been tested?
Screenshots
Types of changes
Enhancement
Checklist:
*.native.js
files for terms that need renaming or removal).