Skip to content
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

Add __next40pxDefaultSize for files in editor 3 #65139

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

AKSHAT2802
Copy link
Contributor

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?

Add __next40pxDefaultSize in button on the component.

Testing Instructions

Screenshots added as comments in file changes

Copy link

github-actions bot commented Sep 8, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: AKSHAT2802 <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: mirka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Sep 8, 2024
Copy link

github-actions bot commented Sep 8, 2024

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @AKSHAT2802! 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.

@@ -428,8 +428,7 @@ export function HierarchicalTermSelector( { slug } ) {
{ ! loading && hasCreateAction && (
<FlexItem>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
term selector before term selector after

Note:- button variant set to link.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@mirka, it felt off that we're forcing the size prop here. After all variant="link" buttons override the height to auto anyway? We're almost done with this migration, but if we were just beginning with it, maybe it would have made sense to exclude the variant="link" buttons from enforcing the size prop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. We'll make sure to exclude these when we start throwing deprecation warnings in console.

@@ -62,8 +62,7 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
{ terms.map( ( term ) => (
<li key={ term.id }>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
Most used term before Most used term after
Note: Button variant set to link.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we have an awkward override here:

.components-button {
font-size: 12px;
}

My preference: I'd just remove that override, and go with the 13px. The default font size is 13px, so it wouldn't make much difference.

If we really wanted to make it smaller, we could use the size="small" prop, although I don't see a good reason to do it here.

@@ -110,8 +110,7 @@ export default function PostURL( { onClose } ) {
}
suffix={
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before After
post url before post url after

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already defacto addressed as part of #64824 - InputControl would pass the __next40pxDefaultSize size prop along to the prefix and suffix component, and the underlying Button was obtaining it.

It's likely you were using an old trunk when making the Before screenshot. In my testing, I see a 40px height button already, with and without this change. However, for consistency, it only makes sense we pass that prop here.

So, nothing to do here 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually these screenshots are of a different UI. This file renders this UI here:

Post URL popover

☝️ Since this is in an InputControl prefix slot, we want this copy button to be size="small", and wrap it in a <InputControlSuffixWrapper variant="control">.

Please see this With Icon Or Control story for an example.

@shail-mehta shail-mehta added the [Type] Code Quality Issues or PRs that relate to code quality label Sep 9, 2024
@tyxla tyxla requested a review from a team September 10, 2024 13:13
@tyxla tyxla assigned tyxla and AKSHAT2802 and unassigned tyxla Sep 10, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this one @AKSHAT2802 🙌

Things mostly look good, but there are some opportunities for cleanup.

My biggest concern is the lack of consistency with the rest of the PostSummary buttons if we merge this one separately. Should we merge together with the rest? cc @mirka @ciampo

@@ -428,8 +428,7 @@ export function HierarchicalTermSelector( { slug } ) {
{ ! loading && hasCreateAction && (
<FlexItem>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@mirka, it felt off that we're forcing the size prop here. After all variant="link" buttons override the height to auto anyway? We're almost done with this migration, but if we were just beginning with it, maybe it would have made sense to exclude the variant="link" buttons from enforcing the size prop.

@@ -62,8 +62,7 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
{ terms.map( ( term ) => (
<li key={ term.id }>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we have an awkward override here:

.components-button {
font-size: 12px;
}

My preference: I'd just remove that override, and go with the 13px. The default font size is 13px, so it wouldn't make much difference.

If we really wanted to make it smaller, we could use the size="small" prop, although I don't see a good reason to do it here.

@@ -110,8 +110,7 @@ export default function PostURL( { onClose } ) {
}
suffix={
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already defacto addressed as part of #64824 - InputControl would pass the __next40pxDefaultSize size prop along to the prefix and suffix component, and the underlying Button was obtaining it.

It's likely you were using an old trunk when making the Before screenshot. In my testing, I see a 40px height button already, with and without this change. However, for consistency, it only makes sense we pass that prop here.

So, nothing to do here 👍

@AKSHAT2802
Copy link
Contributor Author

Hii @mirka @tyxla
I have removed redundant style for font-size: 13px; and reverted change for classic-theme.js file as it can be treated separately according to this.

@mirka
Copy link
Member

mirka commented Sep 16, 2024

@AKSHAT2802 Could we also address this one please? #65139 (comment)

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants