-
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
Spacing Support: Update padding support to allow configurable sides #30607
Spacing Support: Update padding support to allow configurable sides #30607
Conversation
Size Change: +137 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
@@ -6,13 +6,20 @@ import { | |||
__experimentalBoxControl as BoxControl, |
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.
For another time in the future, it looks like the global styles UI could share a lot of code with the hooks (not specific to this PR). cc @nosolosw
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.
On the topic of sharing, there could be some benefit for the block support hooks to be able to access the default theme.json style values e.g. to reset controls correctly. From memory, I don't think these values are currently available within the post editor's state like they are in the site editor.
So if a RangeControl is reset it might just be to 0
however the managed styles created from the theme.json might be 50
. The result is visually the control doesn't really match what is seen in the editor.
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.
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 PR is looking very good. We just need to figure the format of the "sides" and land both these two PRs.
fac2ed0
to
f6668f7
Compare
f6668f7
to
786f915
Compare
This could use a rebase, now that we merged the configurable sides for the component. |
786f915
to
99995d3
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.
Left a comment about useEditorFeature that I think is important. Other than that this looks good, I think we should probably add a paragraph about this to block-supports.md
documentation.
I've updated the All that is left I believe is to get a confirmation on what should be changed regarding |
This includes the addition of spacing.js which is a slight refactor so the padding support is no longer an ad-hoc addition within style.js and matches the approach with colors, typography, borders etc.
c4144eb
to
d3588ea
Compare
This has been rebased after the changes on trunk to padding.js and spacing-panel.js fixing custom CSS units. |
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 looks good to me. @nosolosw any thoughts?
label={ __( 'Padding' ) } | ||
units={ units } | ||
/> | ||
{ showPaddingControl && ( |
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.
Should we hide the panel entirely if there's no padding control?
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.
Unless I've missed something, we already do.
Within global-styles-sidebar.js
there is a check using useHasSpacingPanel
as to whether the SpacingPanel
should be displayed. This matches the current approach for the typography, color and border panels.
The showPaddingControl
check here within the component is because we'll soon be adding a control for margins as well.
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 guess I was just wondering why this component (taken separately) renders an empty panel if padding is not shown (I'm sure this will change with the addition of margins though). This is not that important.
The only "blocker" for me would be to clarify https://github.com/WordPress/gutenberg/pull/30607/files#r621172978 |
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.
Nice one!
I see there are some conflicts but they're simply import issues. |
Just discovered the "conflicts" tool from GitHub so I went ahead and fixed those conflicts ― it's nice! This is ready to merge once the tests pass. |
Thanks for all the help on this 🙇 Hopefully by proxy this has resolved a lot of the issues for adding margin support in #30608 and it should be an easier review. |
Description
This builds upon #30606 which updates the BoxControl to allow configurable sides.
In this PR, the spacing support is updated to accept this new configuration. Its inclusion into the
hooks/style.js
is refactored a little as well to bring it in line with other block supports and smooth the addition of margin support in the next PR of this chain.How has this been tested?
Manually.
Test Instructions
"padding": [ "top", "bottom" ]
Test Instruction - Global Styles
core/group
block context opting into padding support but only for top/bottom sides.styles
to addcore/group
block context, specifying padding values.Screenshots
Types of changes
New feature. Enhancement.
Checklist:
*.native.js
files for terms that need renaming or removal).