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

Notice: Add appropriate size props to Buttons #66593

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
### Enhancements

- `PaletteEdit`: use `Item` internally instead of custom styles ([#66164](https://github.com/WordPress/gutenberg/pull/66164)).
- `Notice`: Add appropriate size props to Buttons ([#66593](https://github.com/WordPress/gutenberg/pull/66593)).

### Experimental

Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/notice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function Notice( {

return (
<Button
__next40pxDefaultSize
Copy link
Member Author

Choose a reason for hiding this comment

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

Before After
Notice action buttons, before Notice action buttons, after

Copy link
Member

Choose a reason for hiding this comment

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

LGTM in the template validation notice:

Screenshot 2024-10-30 at 14 49 41

key={ index }
href={ url }
variant={ computedVariant }
Expand All @@ -160,6 +161,7 @@ function Notice( {
</div>
{ isDismissible && (
<Button
size="small"
Copy link
Member Author

Choose a reason for hiding this comment

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

The Notice will naturally reduce to a shorter height, due to the smaller button. This matches the current Figma specs, so I'm going to assume this is correct (cc @WordPress/gutenberg-design).

Before After
Notice close button, before Notice close button, after

Copy link
Member

Choose a reason for hiding this comment

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

I'm good with this, but I'd love to get a design confirmation before we 🚢 it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fine until we holistically revisit the Notice design.

className="components-notice__dismiss"
icon={ close }
label={ __( 'Close' ) }
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/notice/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export const NoticeListSubcomponent: StoryFn< typeof NoticeList > = () => {
return (
<>
<NoticeList notices={ notices } onRemove={ removeNotice } />
<Button variant="primary" onClick={ resetNotices }>
<Button
__next40pxDefaultSize
Copy link
Member Author

Choose a reason for hiding this comment

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

Reset button in story

Copy link
Member

Choose a reason for hiding this comment

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

Pre-existing, but isn't it weird that those notices have no margins by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure 🤷 This component is on the "needs design updates" docket though.

variant="primary"
onClick={ resetNotices }
>
Reset Notices
</Button>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ exports[`Notice should match snapshot 1`] = `
class="components-notice__actions"
>
<a
class="components-button components-notice__action is-link"
class="components-button components-notice__action is-next-40px-default-size is-link"
href="https://example.com"
>
More information
</a>
<button
class="components-button components-notice__action is-secondary"
class="components-button components-notice__action is-next-40px-default-size is-secondary"
type="button"
>
Cancel
</button>
<button
class="components-button components-notice__action is-primary"
class="components-button components-notice__action is-next-40px-default-size is-primary"
type="button"
>
Submit
Expand All @@ -42,7 +42,7 @@ exports[`Notice should match snapshot 1`] = `
</div>
<button
aria-label="Close"
class="components-button components-notice__dismiss has-icon"
class="components-button components-notice__dismiss is-small has-icon"
type="button"
>
<svg
Expand Down
Loading