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 12 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 @@ -29,6 +29,7 @@
- `DropdownMenu`: Increase option height to 40px ([#67435](https://github.com/WordPress/gutenberg/pull/67435)).
- `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)).
- `Button`: Adjust `secondary` variant hover style. ([#67325](https://github.com/WordPress/gutenberg/pull/67325)).

### Experimental

Expand Down
15 changes: 9 additions & 6 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 @@ -166,13 +167,14 @@
&: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. */
jameskoster marked this conversation as resolved.
Show resolved Hide resolved
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. */
jameskoster marked this conversation as resolved.
Show resolved Hide resolved
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 +222,8 @@
}
}

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