Fix: Button Replace remaining 40px default size violations [Block Editor 2]#65308
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Dhruvang2001. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @dhruvang21! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Hi @dhruvang21, Can you please add This would help us to check the change visually. Thank You, |
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| __next40pxDefaultSize |
There was a problem hiding this comment.
These buttons currently have style overrides that are unnecessary and can be replaced with the compact size
- Let's remove the
__next40pxDefaultSizeon all 4 buttons in this file and add `size="compact" - Let's also remove the
size="default"prop on the last button (replaced bysize="compact") - We can, therefore, remove these overrides, which are now unnecessary
Finally, as an extra step, I noticed that there are more style overrides for when the "show icon labels" preference is enabled. Those style overrides use the internal components-button classname, which is private. We can make the following changes to improve the code:
- add
className="block-editor-patterns__grid-pagination-button"to all 4 instances ofButtonin the file - tweak the CSS selector in the style overrides:
diff --git a/packages/block-editor/src/components/block-patterns-paging/style.scss b/packages/block-editor/src/components/block-patterns-paging/style.scss
index f5f34d8212..b903334460 100644
--- a/packages/block-editor/src/components/block-patterns-paging/style.scss
+++ b/packages/block-editor/src/components/block-patterns-paging/style.scss
@@ -23,8 +23,7 @@
}
.show-icon-labels {
- .block-editor-patterns__grid-pagination {
- .components-button {
+ .block-editor-patterns__grid-pagination-button {
width: auto;
// Hide the button icons when labels are set to display...
span {
ciampo
left a comment
There was a problem hiding this comment.
Thank you @dhruvang21 for working on this, and sorry for the delay in reviewing your PR.
For future work, it would greatly help if you could add screenshots (or a comment to why to you couldn't produce a screenshot).
I recommend you rebase (or merge trunk into) this PR, so that it's up to date with the upstream repository.
I also left some comments that would need to be addressed before we can move forward.
Thank you again, and let me know in case anything isn't clear.
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| __next40pxDefaultSize |
There was a problem hiding this comment.
Noting that this Button is used in a deprecated component, and therefore we should be ok to make this change without the need to really test much about it.
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| __next40pxDefaultSize |
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| __next40pxDefaultSize |
There was a problem hiding this comment.
These buttons currently have style overrides that are unnecessary and can be replaced with the compact size
- Let's remove the
__next40pxDefaultSizeon all 4 buttons in this file and add `size="compact" - Let's also remove the
size="default"prop on the last button (replaced bysize="compact") - We can, therefore, remove these overrides, which are now unnecessary
Finally, as an extra step, I noticed that there are more style overrides for when the "show icon labels" preference is enabled. Those style overrides use the internal components-button classname, which is private. We can make the following changes to improve the code:
- add
className="block-editor-patterns__grid-pagination-button"to all 4 instances ofButtonin the file - tweak the CSS selector in the style overrides:
diff --git a/packages/block-editor/src/components/block-patterns-paging/style.scss b/packages/block-editor/src/components/block-patterns-paging/style.scss
index f5f34d8212..b903334460 100644
--- a/packages/block-editor/src/components/block-patterns-paging/style.scss
+++ b/packages/block-editor/src/components/block-patterns-paging/style.scss
@@ -23,8 +23,7 @@
}
.show-icon-labels {
- .block-editor-patterns__grid-pagination {
- .components-button {
+ .block-editor-patterns__grid-pagination-button {
width: auto;
// Hide the button icons when labels are set to display...
span {
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| __next40pxDefaultSize |
There was a problem hiding this comment.
This file was removed in #65204 (comment), and therefore these changes are not necessary anymore.
In any case, they would have not caused any meaningful differences because those buttons' styles were heavily overridden 😓
Hi @ciampo, Thanks for adding the screenshots! To be honest, I tried to locate the buttons but wasn't successful. I’ll make the necessary changes as per your instructions in the next commit. Thanks again! |
7157ce5 to
0dde589
Compare
|
@Dhruvang2001 I believe that this is the last comment left to address, before being able to merge. Almost there! |
ciampo
left a comment
There was a problem hiding this comment.
Excellent! Thank you again for the collaboration, @Dhruvang2001 🙏
You're very welcome! It's been great collaborating with you as well. Looking forward to more in the future! 🙌 |




Part of - #65018
What?
Issue - #65018, To use default to 40px for the button.
Why?
To make the consistent button across Gutenberg, and we would have a lint rule added once fixed, all the button usage.
How?
Change from __next40pxDefaultSize={ false } to __next40pxDefaultSize on component.
Testing Instructions
Screenshot is added for individual changed files.