From 29c3cdaeb69adfa97dabcc2f1d1a91fae5ccd224 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 29 Jan 2020 10:50:14 -0800 Subject: [PATCH] Disabled button styles --- ui/app/styles/core/buttons.scss | 29 +++++++++++++++++++ ui/stories/components/buttons.stories.js | 36 +++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/ui/app/styles/core/buttons.scss b/ui/app/styles/core/buttons.scss index 1ba83b729..1fc5c7a53 100644 --- a/ui/app/styles/core/buttons.scss +++ b/ui/app/styles/core/buttons.scss @@ -43,6 +43,17 @@ $button-box-shadow-standard: 0 2px 0 0 rgba($grey, 0.2); box-shadow: none; } + &.is-disabled { + opacity: 0.7; + box-shadow: none; + cursor: not-allowed; + border-color: transparent; + + &:hover { + border-color: transparent; + } + } + @each $name, $pair in $colors { $color: nth($pair, 1); $color-invert: nth($pair, 2); @@ -116,6 +127,24 @@ $button-box-shadow-standard: 0 2px 0 0 rgba($grey, 0.2); box-shadow: none; } } + + // The is-disabled styles MUST trump other modifier specificites + &.is-disabled { + background-color: $color; + border-color: darken($color, 5%); + box-shadow: none; + + &:hover, + &:active, + &:focus, + &.is-hovered, + &.is-active, + &.is-focused { + background-color: $color; + border-color: darken($color, 5%); + box-shadow: none; + } + } } } diff --git a/ui/stories/components/buttons.stories.js b/ui/stories/components/buttons.stories.js index 166214572..9c139e5b8 100644 --- a/ui/stories/components/buttons.stories.js +++ b/ui/stories/components/buttons.stories.js @@ -75,7 +75,7 @@ export let Sizes = () => { export let Disabled = () => { return { template: hbs` -
Buttons
+
Anchor elements as buttons
Button White @@ -91,6 +91,40 @@ export let Disabled = () => { Warning Danger
+ +
Button elements with disabled attribute
+
+ + + + + + +
+
+ + + + + +
+ +
Button elements with aria-disabled="true"
+
+ + + + + + +
+
+ + + + + +
`, }; };