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

Button: Add hover style to secondary variant #67325

Merged
merged 16 commits into from
Dec 11, 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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- `MenuItem`: Increase height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `MenuItemsChoice`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `Navigation`: Fix active item hover color ([#67732](https://github.com/WordPress/gutenberg/pull/67732)).
- `Button`: Adjust `secondary` variant hover style. ([#67325](https://github.com/WordPress/gutenberg/pull/67325)).

### Deprecations

Expand Down
19 changes: 9 additions & 10 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
display: inline-flex;
text-decoration: none;
font-family: inherit;
font-weight: normal;
font-size: $default-font-size;
margin: 0;
border: 0;
Expand Down Expand Up @@ -139,8 +138,10 @@
color: $components-color-accent;
background: transparent;

&:hover:not(:disabled, [aria-disabled="true"]) {
box-shadow: inset 0 0 0 $border-width $components-color-accent-darker-10;
&:hover:not(:disabled, [aria-disabled="true"], .is-pressed) {
box-shadow: inset 0 0 0 $border-width $components-color-accent-darker-20;
color: $components-color-accent-darker-20;
background: color-mix(in srgb, $components-color-accent 4%, transparent);
}

&:disabled:not(:focus),
Expand All @@ -164,15 +165,12 @@
background: transparent;

&:hover:not(:disabled, [aria-disabled="true"]) {
// TODO: Prepare for theming (https://github.com/WordPress/gutenberg/pull/45466/files#r1030872724)
/* stylelint-disable-next-line declaration-property-value-disallowed-list -- Allow tertiary buttons to use colors from the user admin color scheme. */
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
background: color-mix(in srgb, $components-color-accent 4%, transparent);
color: $components-color-accent-darker-20;
}

&:active:not(:disabled, [aria-disabled="true"]) {
// TODO: Prepare for theming (https://github.com/WordPress/gutenberg/pull/45466/files#r1030872724)
/* stylelint-disable-next-line declaration-property-value-disallowed-list -- Allow tertiary buttons to use colors from the user admin color scheme. */
background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
background: color-mix(in srgb, $components-color-accent 8%, transparent);
}

// Pull left if the tertiary button stands alone after a description, so as to vertically align with items above.
Expand Down Expand Up @@ -220,7 +218,8 @@
}
}

&.is-tertiary {
&.is-tertiary,
&.is-secondary {
&:hover:not(:disabled, [aria-disabled="true"]) {
background: rgba($alert-red, 0.04);
}
Expand Down
Loading