checkpoint on switches prior to new prototype

This commit is contained in:
Kevin Ross 2015-12-15 17:20:11 -06:00
parent ef738470ad
commit 188f470f02
4 changed files with 49 additions and 47 deletions

View File

@ -13,7 +13,7 @@ const Switch = (($) => {
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME] const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
const Default = { const Default = {
template: `<span class='switch-decorator'></span>` template: `<span class='mdb-switch-track'></span>`
} }
/** /**

View File

@ -44,24 +44,26 @@ label.checkbox-inline {
height: $mdb-checkbox-size; height: $mdb-checkbox-size;
overflow: hidden; overflow: hidden;
border: $border-radius solid $mdb-checkbox-border-color; border: $border-radius solid $mdb-checkbox-border-color;
}
.check::before { // checkbox outline
position: absolute; &::before {
display: block; position: absolute;
width: 0; display: block;
height: 0; width: 0;
margin-top: -4px; height: 0;
margin-left: 6px; margin-top: -4px;
content: ""; margin-left: 6px;
box-shadow: 0 0 0 0, content: "";
0 0 0 0, box-shadow: 0 0 0 0,
0 0 0 0, 0 0 0 0,
0 0 0 0, 0 0 0 0,
0 0 0 0, 0 0 0 0,
0 0 0 0, 0 0 0 0,
0 0 0 0 inset; 0 0 0 0,
transform: rotate(45deg); 0 0 0 0 inset;
animation: checkbox-off $mdb-checkbox-animation-check forwards; transform: rotate(45deg);
animation: checkbox-off $mdb-checkbox-animation-check forwards;
}
} }
} }

View File

@ -1,8 +1,10 @@
// http://codepen.io/rosskevin/pen/EPPwRR?editors=110
.switch { .switch {
&, &,
label, label,
input, input,
.switch-decorator { .mdb-switch-track {
user-select: none; user-select: none;
} }
@ -16,40 +18,36 @@
opacity: 0; opacity: 0;
// Handle disabled // Handle disabled
&[disabled] { &[disabled],
+ .switch-decorator::after, fieldset[disabled] & {
&:checked + .switch-decorator::after { + .mdb-switch-track::after,
background-color: $mdb-label-color; &:checked + .mdb-switch-track::after {
//background-color: $mdb-label-color;
} }
} }
//+ .switch-decorator:active::after, + .mdb-switch-track:active::after {
//&[disabled] + .switch-decorator:active::after { //box-shadow: 0 1px 3px 1px rgba($black, 0.4), 0 0 0 15px rgba($black, 0.1);
// box-shadow: 0 1px 3px 1px rgba($black, 0.4), 0 0 0 15px rgba($black, 0.1); @include shadow-4dp();
//} }
// Ripple off and disabled // Ripple off and disabled
&:checked + .switch-decorator::after { &:checked + .mdb-switch-track::after {
left: 15px; left: 15px;
} }
} }
.switch-decorator { .mdb-switch-track {
display: inline-block;
width: 30px;
height: 15px;
margin-right: 15px;
text-align: left; // Issue #737 horizontal form text-align: left; // Issue #737 horizontal form
vertical-align: middle;
// Switch bg off and disabled content: "";
&, background-color: $mdb-mdb-switch-track-color;
input[type=checkbox][disabled] + & { border-radius: 15px;
display: inline-block; transition: background 0.3s ease;
width: 30px;
height: 15px;
margin-right: 15px;
vertical-align: middle;
content: "";
background-color: rgba(80, 80, 80, 0.7);
border-radius: 15px;
transition: background 0.3s ease;
}
// Thumb // Thumb
&::after { &::after {
@ -70,7 +68,7 @@
// set bg when checked // set bg when checked
input[type=checkbox]:checked { input[type=checkbox]:checked {
+ .switch-decorator { + .mdb-switch-track {
background-color: rgba($mdb-switch-color-checked, (50 / 100)); // Switch bg on background-color: rgba($mdb-switch-color-checked, (50 / 100)); // Switch bg on
&::after { &::after {

View File

@ -79,14 +79,16 @@ $text-disabled: #a8a8a8 !default;
$background-disabled: #eaeaea !default; $background-disabled: #eaeaea !default;
// Checkboxes // Checkboxes
$mdb-checkbox-size: 20px !default; $mdb-checkbox-size: 1.25rem !default;
$mdb-checkbox-animation-ripple: 500ms !default; $mdb-checkbox-animation-ripple: 500ms !default;
$mdb-checkbox-animation-check: 0.3s !default; $mdb-checkbox-animation-check: 0.3s !default;
$mdb-checkbox-checked-color: $brand-primary; // #4caf50 !default; $mdb-checkbox-checked-color: $brand-primary !default;
$mdb-checkbox-border-color: $mdb-label-color-inner-focus !default; $mdb-checkbox-border-color: $mdb-label-color-inner-focus !default;
// Switches // Switches
$mdb-switch-color-checked: $brand-primary; $mdb-switch-color-checked: $brand-primary;
$mdb-mdb-switch-track-color: $gray-light;
//$mdb-switch-color-disabled: $gray-light;
// Popovers and Popups // Popovers and Popups
$mdb-popover-background: rgba(101, 101, 101, 0.9) !default; $mdb-popover-background: rgba(101, 101, 101, 0.9) !default;