Commit cd22eb1d authored by Mark Otto's avatar Mark Otto Committed by GitHub
Browse files

Button code cleanup (#22951)

* use a mixin there
* revamp .btn-link to match default and outline variants
* remove unnecessary properties
parent bb0cab9f
Showing with 36 additions and 38 deletions
+36 -38
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
> .btn { > .btn {
position: relative; position: relative;
flex: 0 1 auto; flex: 0 1 auto;
margin-bottom: 0;
// Bring the hover, focused, and "active" buttons to the front to overlay // Bring the hover, focused, and "active" buttons to the front to overlay
// the borders properly // the borders properly
...@@ -66,15 +65,18 @@ ...@@ -66,15 +65,18 @@
.btn-group > .btn-group { .btn-group > .btn-group {
float: left; float: left;
} }
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0; border-radius: 0;
} }
.btn-group > .btn-group:first-child:not(:last-child) { .btn-group > .btn-group:first-child:not(:last-child) {
> .btn:last-child, > .btn:last-child,
> .dropdown-toggle { > .dropdown-toggle {
@include border-right-radius(0); @include border-right-radius(0);
} }
} }
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
@include border-left-radius(0); @include border-left-radius(0);
} }
...@@ -129,7 +131,6 @@ ...@@ -129,7 +131,6 @@
// //
.btn-group-vertical { .btn-group-vertical {
display: inline-flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
justify-content: center; justify-content: center;
...@@ -146,30 +147,35 @@ ...@@ -146,30 +147,35 @@
margin-top: -$input-btn-border-width; margin-top: -$input-btn-border-width;
margin-left: 0; margin-left: 0;
} }
}
.btn-group-vertical > .btn { > .btn {
&:not(:first-child):not(:last-child) { &:not(:first-child):not(:last-child) {
border-radius: 0; border-radius: 0;
}
} }
&:first-child:not(:last-child) { &:first-child:not(:last-child) {
@include border-bottom-radius(0); @include border-bottom-radius(0);
} }
&:last-child:not(:first-child) { &:last-child:not(:first-child) {
@include border-top-radius(0); @include border-top-radius(0);
} }
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0; border-radius: 0;
} }
.btn-group-vertical > .btn-group:first-child:not(:last-child) {
> .btn:last-child, > .btn-group:first-child:not(:last-child) {
> .dropdown-toggle { > .btn:last-child,
@include border-bottom-radius(0); > .dropdown-toggle {
@include border-bottom-radius(0);
}
}
> .btn-group:last-child:not(:first-child) > .btn:first-child {
@include border-top-radius(0);
} }
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
@include border-top-radius(0);
} }
......
...@@ -71,36 +71,28 @@ fieldset[disabled] a.btn { ...@@ -71,36 +71,28 @@ fieldset[disabled] a.btn {
.btn-link { .btn-link {
font-weight: $font-weight-normal; font-weight: $font-weight-normal;
color: $link-color; color: $link-color;
background-color: transparent;
border-radius: 0; border-radius: 0;
&, @include hover {
&:active, color: $link-hover-color;
&.active, text-decoration: $link-hover-decoration;
&:disabled {
background-color: transparent; background-color: transparent;
@include box-shadow(none); border-color: transparent;
} }
&,
&:focus, &:focus,
&:active { &.focus {
border-color: transparent; border-color: transparent;
box-shadow: none; box-shadow: none;
} }
@include hover {
border-color: transparent;
}
@include hover-focus {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
}
&:disabled {
color: $btn-link-disabled-color;
@include hover-focus { &:disabled,
text-decoration: none; &.disabled {
} color: $btn-link-disabled-color;
} }
// No need for an active state here
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
border-color: $border; border-color: $border;
@include box-shadow($btn-box-shadow); @include box-shadow($btn-box-shadow);
&:hover { @include hover {
@include color-yiq($background); @include color-yiq($background);
background-color: $active-background; background-color: $active-background;
border-color: $active-border; border-color: $active-border;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment