-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
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, |
@@ -38,8 +38,7 @@ export default function Pagination( { | |||
className="block-editor-patterns__grid-pagination-previous" | |||
> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
These buttons currently have style overrides that are unnecessary and can be replaced with the compact
size
- Let's remove the
__next40pxDefaultSize
on 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 ofButton
in 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 {
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.
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.
@@ -27,8 +27,7 @@ function BlockNavigationDropdownToggle( { | |||
} ) { | |||
return ( | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
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.
@@ -18,8 +18,7 @@ import { VIEWMODES } from './constants'; | |||
const Actions = ( { onBlockPatternSelect } ) => ( | |||
<div className="block-editor-block-pattern-setup__actions"> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
packages/block-editor/src/components/block-pattern-setup/setup-toolbar.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-pattern-setup/setup-toolbar.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-pattern-setup/setup-toolbar.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-pattern-setup/setup-toolbar.js
Outdated
Show resolved
Hide resolved
@@ -38,8 +38,7 @@ export default function Pagination( { | |||
className="block-editor-patterns__grid-pagination-previous" | |||
> | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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.
These buttons currently have style overrides that are unnecessary and can be replaced with the compact
size
- Let's remove the
__next40pxDefaultSize
on 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 ofButton
in 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 {
@@ -59,8 +59,7 @@ function BlockQuickNavigationItem( { clientId, onSelect } ) { | |||
|
|||
return ( | |||
<Button | |||
// TODO: Switch to `true` (40px size) if possible | |||
__next40pxDefaultSize={ false } | |||
__next40pxDefaultSize |
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 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
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.
These style overrides can be also removed
@Dhruvang2001 I believe that this is the last comment left to address, before being able to merge. Almost there! |
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.
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.