refactored and simplified the markup for the focus underline animation

This commit is contained in:
Kevin Ross 2015-12-08 18:11:42 -06:00
parent f50a8866b1
commit 7d29f0b696

View File

@ -183,42 +183,34 @@
//} //}
} }
// Focus underline animation =================================
// BOTTOM BARS =================================
.mdb-form-control-decorator { .mdb-form-control-decorator {
position: relative; position: relative;
top: (-1 * $input-border-width); // move the top up enough to overlay the border from the input top: (-1 * $input-border-width); // move the top up enough to overlay the border from the input
display: block; display: block;
//width: 300px; &::before,
} &::after {
.mdb-form-control-decorator::before, position: absolute;
.mdb-form-control-decorator::after { width: 0;
position: absolute; height: $input-border-width;
//bottom: 1px; content: "";
width: 0; @include gradient-vertical($brand-primary, $mdb-input-underline-color);
height: $input-border-width; transition: 0.3s ease all;
content: "";
@include gradient-vertical($brand-primary, $mdb-input-underline-color);
transition: 0.3s ease all;
}
.mdb-form-control-decorator::before {
left: 50%;
}
.mdb-form-control-decorator::after {
right: 50%;
}
// active state // focused state - it transitions the width of each (before and after) to 50% creating the center out effect
//input:focus ~ .mdb-form-control-decorator:before, .form-control:focus ~ &,
//input:focus ~ .mdb-form-control-decorator:after { .mdb-form-group.is-focused .form-control ~ & {
.form-control:focus, width: 50%;
.mdb-form-group.is-focused .form-control { }
~ .mdb-form-control-decorator::before, }
~ .mdb-form-control-decorator::after { &::before {
width: 50%; left: 50%;
}
&::after {
right: 50%;
} }
} }
// BOTTOM BARS ================================= // Focus underline animation =================================
// ----- // -----
// Labels with mdb-form-group signalled state // Labels with mdb-form-group signalled state