Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 6 commits
9c109ce
589368e
e962dcd
5a2bf1f
d3588ea
2567acf
5d1b856
a3497f9
ac06fb4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 be50
. 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.
I'd like to see that very much. I think the current struggle is that the hooks depend on the block's attributes as input (example).
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 usinguseHasSpacingPanel
as to whether theSpacingPanel
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.