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

Inserter: Use 40px default size for toggle button #68155

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
color: $white;
padding: 0;

// TODO: Consider passing size="small" to the Inserter toggle instead.
// Special dimensions for this button.
min-width: $button-size-small;
height: $button-size-small;
Comment on lines +81 to 84
Copy link
Member Author

Choose a reason for hiding this comment

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

Virtually all usage in Gutenberg seem to be overriding the toggle Button size to be 24px. They should consider using size="small" instead of doing this with custom CSS (out of scope for this PR, so I left TODO comments).

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like a worthy follow-up 👍

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
color: $white;
padding: 0;

// TODO: Consider passing size="small" to the Inserter toggle instead.
// Special dimensions for this button.
min-width: $button-size-small;
height: $button-size-small;
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const defaultRenderToggle = ( {

return (
<Wrapper
__next40pxDefaultSize={ toggleProps.as ? undefined : true }
Copy link
Member Author

Choose a reason for hiding this comment

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

Consumers who are rendering a custom toggle button with the as prop will need to take care of this themselves.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as #68157 (comment) re. checking if toggleProps.as === Button` ?

icon={ plus }
label={ label }
tooltipPosition="bottom"
Expand Down
Loading