_sass/bootstrap/_buttons.scss in apx-docs-theme-0.1.7 vs _sass/bootstrap/_buttons.scss in apx-docs-theme-0.1.15
- old
+ new
@@ -1,162 +1,134 @@
-//
-// Buttons
-// --------------------------------------------------
+// stylelint-disable selector-no-qualifying-type
-
+//
// Base styles
-// --------------------------------------------------
+//
.btn {
display: inline-block;
- margin-bottom: 0; // For input.btn
font-weight: $btn-font-weight;
+ color: $body-color;
text-align: center;
vertical-align: middle;
- touch-action: manipulation;
- cursor: pointer;
- background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
- border: 1px solid transparent;
- white-space: nowrap;
- @include button-size($padding-base-vertical, $padding-base-horizontal, $font-size-base, $line-height-base, $btn-border-radius-base);
- @include user-select(none);
+ user-select: none;
+ background-color: transparent;
+ border: $btn-border-width solid transparent;
+ @include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
+ @include transition($btn-transition);
- &,
- &:active,
- &.active {
- &:focus,
- &.focus {
- @include tab-focus;
- }
+ @include hover {
+ color: $body-color;
+ text-decoration: none;
}
- &:hover,
&:focus,
&.focus {
- color: $btn-default-color;
- text-decoration: none;
- }
-
- &:active,
- &.active {
outline: 0;
- background-image: none;
- @include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
+ box-shadow: $btn-focus-box-shadow;
}
+ // Disabled comes first so active can properly restyle
&.disabled,
- &[disabled],
- fieldset[disabled] & {
- cursor: $cursor-disabled;
- @include opacity(.65);
+ &:disabled {
+ opacity: $btn-disabled-opacity;
@include box-shadow(none);
}
- // [converter] extracted a& to a.btn
-}
+ // Opinionated: add "hand" cursor to non-disabled .btn elements
+ &:not(:disabled):not(.disabled) {
+ cursor: pointer;
+ }
-a.btn {
- &.disabled,
- fieldset[disabled] & {
- pointer-events: none; // Future-proof disabling of clicks on `<a>` elements
+ &:not(:disabled):not(.disabled):active,
+ &:not(:disabled):not(.disabled).active {
+ @include box-shadow($btn-active-box-shadow);
+
+ &:focus {
+ @include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
+ }
}
}
+// Future-proof disabling of clicks on `<a>` elements
+a.btn.disabled,
+fieldset:disabled a.btn {
+ pointer-events: none;
+}
+
+//
// Alternate buttons
-// --------------------------------------------------
+//
-.btn-default {
- @include button-variant($btn-default-color, $btn-default-bg, $btn-default-border);
+@each $color, $value in $theme-colors {
+ .btn-#{$color} {
+ @include button-variant($value, $value);
+ }
}
-.btn-primary {
- @include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border);
+
+@each $color, $value in $theme-colors {
+ .btn-outline-#{$color} {
+ @include button-outline-variant($value);
+ }
}
-// Success appears as green
-.btn-success {
- @include button-variant($btn-success-color, $btn-success-bg, $btn-success-border);
-}
-// Info appears as blue-green
-.btn-info {
- @include button-variant($btn-info-color, $btn-info-bg, $btn-info-border);
-}
-// Warning appears as orange
-.btn-warning {
- @include button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border);
-}
-// Danger and error appear as red
-.btn-danger {
- @include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border);
-}
+//
// Link buttons
-// -------------------------
+//
// Make a button look and behave like a link
.btn-link {
+ font-weight: $font-weight-normal;
color: $link-color;
- font-weight: normal;
- border-radius: 0;
- &,
- &:active,
- &.active,
- &[disabled],
- fieldset[disabled] & {
- background-color: transparent;
- @include box-shadow(none);
+ @include hover {
+ color: $link-hover-color;
+ text-decoration: $link-hover-decoration;
}
- &,
- &:hover,
+
&:focus,
- &:active {
- border-color: transparent;
- }
- &:hover,
- &:focus {
- color: $link-hover-color;
+ &.focus {
text-decoration: $link-hover-decoration;
- background-color: transparent;
+ box-shadow: none;
}
- &[disabled],
- fieldset[disabled] & {
- &:hover,
- &:focus {
- color: $btn-link-disabled-color;
- text-decoration: none;
- }
+
+ &:disabled,
+ &.disabled {
+ color: $btn-link-disabled-color;
+ pointer-events: none;
}
+
+ // No need for an active state here
}
+//
// Button Sizes
-// --------------------------------------------------
+//
.btn-lg {
- // line-height: ensure even-numbered height of button next to large input
- @include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
+ @include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
}
+
.btn-sm {
- // line-height: ensure proper height of button next to small input
- @include button-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
+ @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-line-height-sm, $btn-border-radius-sm);
}
-.btn-xs {
- @include button-size($padding-xs-vertical, $padding-xs-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
-}
+//
// Block button
-// --------------------------------------------------
+//
.btn-block {
display: block;
width: 100%;
-}
-// Vertically space out multiple block buttons
-.btn-block + .btn-block {
- margin-top: 5px;
+ // Vertically space out multiple block buttons
+ + .btn-block {
+ margin-top: $btn-block-spacing-y;
+ }
}
// Specificity overrides
input[type="submit"],
input[type="reset"],