Skip to content

Commit

Permalink
Merge pull request #1110 from nationalarchives/feature/danger-button
Browse files Browse the repository at this point in the history
Add a new 'danger button'
  • Loading branch information
jacksonj04 authored Aug 10, 2023
2 parents 01758c9 + 9a77383 commit 5dc104f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
35 changes: 35 additions & 0 deletions ds_caselaw_editor_ui/sass/includes/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,38 @@
}
}
}

.button-danger {
@include call-to-action-button;
background-color: $color__white;
border: 2px solid $color__red;
color: $color__red;

&:visited {
color: $color__cta-background;
}

&:focus,
&:hover {
background-color: $color__red;
color: $color__white;
outline-color: $color__red;
border-color: $color__red;
}

&:disabled,
&[aria-disabled="true"] {
$color__desaturated-red: desaturate($color__red, 60%);
color: $color__desaturated-red;
background-color: $color__white;
border-color: lighten($color__desaturated-red, 30%);
&:focus,
&:hover {
outline: none;
background-color: $color__white;
color: $color__desaturated-red;
text-decoration: none;
cursor: not-allowed;
}
}
}
19 changes: 17 additions & 2 deletions ds_caselaw_editor_ui/templates/includes/style_guide/buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ <h4>Call to action button</h4>
<p>
Use with <code>class="button-cta"</code>:
</p>
<button class="button-cta">This is a call to action</button>
<button class="button-cta">Call to action</button>
<button class="button-cta" disabled>Call to action (disabled)</button>
<h4>Secondary button</h4>
<details>
<summary>Usage details</summary>
Expand All @@ -22,4 +23,18 @@ <h4>Secondary button</h4>
<p>
Use with <code>class="button-secondary"</code>:
</p>
<button class="button-secondary">This is a secondary button</button>
<button class="button-secondary">Secondary button</button>
<button class="button-secondary" disabled>Secondary button (disabled)</button>
<h4>Danger button</h4>
<details>
<summary>Usage details</summary>
<p>
This button indicates that the action which will be taken is potentially destructive, and should be used with
caution.
</p>
</details>
<p>
Use with <code>class="button-danger"</code>:
</p>
<button class="button-danger">Danger button</button>
<button class="button-danger" disabled>Danger button (disabled)</button>

0 comments on commit 5dc104f

Please sign in to comment.