-
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
Add props for buttons in editor 1 #65068
Add props for buttons in editor 1 #65068
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 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, @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. |
@@ -67,8 +67,7 @@ function BlockManager( { | |||
numberOfHiddenBlocks | |||
) } | |||
<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.
Note for posterity: There are no explicit height styles for this, just that "link"
variant Buttons have height: auto
applied.
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.
😅
@@ -25,8 +25,7 @@ function EditorHistoryRedo( props, ref ) { | |||
const { redo } = useDispatch( editorStore ); | |||
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.
Note for posterity: In our app code, sizes are added by the consumers.
gutenberg/packages/editor/src/components/document-tools/index.js
Lines 151 to 156 in 9523fb4
<ToolbarItem | |
as={ EditorHistoryUndo } | |
showTooltip={ ! showIconLabels } | |
variant={ showIconLabels ? 'tertiary' : undefined } | |
size="compact" | |
/> |
@@ -30,8 +30,7 @@ function CopyButton( { text, children } ) { | |||
const ref = useCopyToClipboard( text ); | |||
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.
@@ -198,8 +198,7 @@ function PrivateExcerpt() { | |||
ref={ setPopoverAnchor } | |||
renderToggle={ ( { onToggle } ) => ( | |||
<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.
@@ -160,8 +160,7 @@ function PostFeaturedImage( { | |||
render={ ( { open } ) => ( | |||
<div className="editor-post-featured-image__container"> | |||
<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.
Looks like we can remove most of these style overrides?
.editor-post-featured-image__toggle { | |
height: 100%; | |
line-height: 20px; | |
padding: $grid-unit-10 0; | |
text-align: center; | |
box-shadow: inset 0 0 0 $border-width $gray-400; | |
} |
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.
Before | After |
Hii @mirka removed extra styles
PFA Before and After screenshots
@@ -202,17 +201,15 @@ function PostFeaturedImage( { | |||
{ !! featuredImageId && ( | |||
<HStack className="editor-post-featured-image__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.
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.
Looks like the before/after images are reversed in this one.
We probably need an !important
here:
height: auto; |
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.
Before | After |
Hii @mirka , height: auto !important
; added for featured image.
PFA new screenshots.
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 noticed a weird flash on focus, but this happens on trunk too so I'll post a separate issue.
CleanShot.2024-09-13.at.05.11.47.mp4
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.
Issue submitted at #65299
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.
Looks good, thank you for the follow-ups!
@@ -202,17 +201,15 @@ function PostFeaturedImage( { | |||
{ !! featuredImageId && ( | |||
<HStack className="editor-post-featured-image__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.
I noticed a weird flash on focus, but this happens on trunk too so I'll post a separate issue.
Part of - #65018
What?
Issue - #65018, To use default to 40px for the button.
This would fix blocks like Block Manager, Undo, Redo, error boundary, Post excerpt, Featured Image
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 comment in file changes