Solves #735 togglebuttons example rendering outside of .form-group

This commit is contained in:
Kevin Ross 2015-11-21 12:15:29 -06:00
parent 0993d7b564
commit 15446adb11

View File

@ -1,92 +1,70 @@
.form-group-toggle-variant(@placeholder-font-size, @line-height){ .togglebutton {
.togglebutton { vertical-align: middle;
// Label is set in _inputs.less &, label, input, .toggle {
user-select: none;
} }
} label {
cursor: pointer;
color: @mdb-toggle-label-color;
.form-group { // Hide original checkbox
input[type=checkbox] {
//// default label size/location opacity: 0;
.form-group-toggle-variant(@mdb-input-font-size-base, @mdb-input-line-height-base); width: 0;
height: 0;
// sm label size/location
&.form-group-sm {
.form-group-toggle-variant(@mdb-input-font-size-small, @mdb-input-line-height-small);
}
// lg label size/location
&.form-group-lg {
.form-group-toggle-variant(@mdb-input-font-size-large, @mdb-input-line-height-large);
}
.togglebutton {
vertical-align: middle;
&, label, input, .toggle {
user-select: none;
} }
label { // Switch bg off and disabled
cursor: pointer; .toggle,
color: @mdb-toggle-label-color; input[type=checkbox][disabled] + .toggle {
content: "";
// Hide original checkbox display: inline-block;
input[type=checkbox] { width: 30px;
opacity: 0; height: 15px;
width: 0; background-color: rgba(80, 80, 80, 0.7);
height: 0; border-radius: 15px;
} margin-right: 15px;
// Switch bg off and disabled transition: background 0.3s ease;
.toggle, vertical-align: middle;
input[type=checkbox][disabled] + .toggle { }
content: ""; // Handle off
display: inline-block; .toggle:after {
width: 30px; content: "";
height: 15px; display: inline-block;
background-color: rgba(80, 80, 80, 0.7); width: 20px;
border-radius: 15px; height: 20px;
margin-right: 15px; background-color: #F1F1F1;
transition: background 0.3s ease; border-radius: 20px;
vertical-align: middle; position: relative;
} box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4);
// Handle off left: -5px;
.toggle:after { top: -2px;
content: ""; transition: left 0.3s ease, background 0.3s ease, box-shadow 0.1s ease;
display: inline-block; }
width: 20px; // Handle disabled
height: 20px; input[type=checkbox][disabled] + .toggle:after,
background-color: #F1F1F1; input[type=checkbox][disabled]:checked + .toggle:after {
border-radius: 20px; background-color: #BDBDBD;
position: relative; }
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4); // Ripple off and disabled
left: -5px; input[type=checkbox] + .toggle:active:after,
top: -2px; input[type=checkbox][disabled] + .toggle:active:after {
transition: left 0.3s ease, background 0.3s ease, box-shadow 0.1s ease; box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 0 0 15px rgba(0, 0, 0, 0.1);
} }
// Handle disabled input[type=checkbox]:checked + .toggle:after {
input[type=checkbox][disabled] + .toggle:after, left: 15px;
input[type=checkbox][disabled]:checked + .toggle:after {
background-color: #BDBDBD;
}
// Ripple off and disabled
input[type=checkbox] + .toggle:active:after,
input[type=checkbox][disabled] + .toggle:active:after {
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 0 0 15px rgba(0, 0, 0, 0.1);
}
input[type=checkbox]:checked + .toggle:after {
left: 15px;
}
} }
// Switch bg on
// SASS conversion note: please mirror any content change in _mixins-shared.scss bg-color-variations-content
.generic-variations(~" label input[type=checkbox]:checked + .toggle", @brand-primary, {
background-color: fade(@mdb-color, 50%);
});
// Handle on
// SASS conversion note: please mirror any content change in _mixins-shared.scss variations-content
.variations(~" label input[type=checkbox]:checked + .toggle:after", background-color, @brand-primary);
// Ripple on
.generic-variations(~" label input[type=checkbox]:checked + .toggle:active:after", @brand-primary, {
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 0 0 15px fade(@mdb-color, 10%);
});
} }
// Switch bg on
// SASS conversion note: please mirror any content change in _mixins-shared.scss bg-color-variations-content
.generic-variations(~" label input[type=checkbox]:checked + .toggle", @brand-primary, {
background-color: fade(@mdb-color, 50%);
});
// Handle on
// SASS conversion note: please mirror any content change in _mixins-shared.scss variations-content
.variations(~" label input[type=checkbox]:checked + .toggle:after", background-color, @brand-primary);
// Ripple on
.generic-variations(~" label input[type=checkbox]:checked + .toggle:active:after", @brand-primary, {
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 0 0 15px fade(@mdb-color, 10%);
});
} }