Skip to content

Commit

Permalink
Ensure danger buttons have red hover state (#2742)
Browse files Browse the repository at this point in the history
074cb1a converted links that submit forms to buttons. To keep these
now-buttons looking like links it uses the `link` class. CSS looks for
buttons that are `not(.link)` to continue to style them appropriately.

However any `.button--danger` buttons did not get all the style
overrides. In particular, `:hover` and `:disabled:hover` states fell
back to the normal button background colors (blue).

This fixes those buttons to have the appropriate red hover states.

In addition, `.link--danger` elements also had a blue hover state. I'm
not sure when this was broken, or if it was always supposed to be like
that. Either way, I changed it so they now also appear slightly darker
when hovered to match the buttons.
  • Loading branch information
edwardloveall authored Feb 18, 2025
1 parent 52218fc commit 808cdfa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
26 changes: 18 additions & 8 deletions app/assets/builds/administrate/application.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/assets/builds/administrate/application.css.map

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions app/assets/stylesheets/administrate/base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ a,
text-decoration-skip-ink: auto;
transition: color $base-duration $base-timing;

/* stylelint-disable selector-no-qualifying-type */
&.link--danger {
color: $red;
}

&:hover {
color: mix($black, $action-color, 25%);
}
Expand All @@ -45,6 +40,14 @@ a,
outline: $focus-outline;
outline-offset: $focus-outline-offset;
}
/* stylelint-disable selector-no-qualifying-type */
&.link--danger {
color: $red;
}

&.link--danger:hover {
color: mix($black, $red, 20%);
}
}

hr {
Expand Down
6 changes: 5 additions & 1 deletion app/assets/stylesheets/administrate/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ button,
.button--danger {
background-color: $red;

&:hover {
&:not(.link):hover {
background-color: mix($black, $red, 20%);
color: $white;
}

&:not(.link):disabled:hover {
background-color: mix($black, $red, 20%);
}
}

.button--nav {
Expand Down

0 comments on commit 808cdfa

Please sign in to comment.