Skip to content

Commit

Permalink
fix: transitions unify to use @media: prefers-reduced-motion
Browse files Browse the repository at this point in the history
  • Loading branch information
codecalm committed Oct 24, 2021
1 parent 52fe2d7 commit d1e2282
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 29 deletions.
8 changes: 5 additions & 3 deletions src/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ $container-variations: (

$content-padding-y: 1.25rem !default;


// Acpect ratios
$aspect-ratios: (
"1x1": 100%,
"4x3": calc(3 / 4 * 100%),
Expand All @@ -270,7 +270,10 @@ $aspect-ratios: (
"9x21": calc(21 / 9 * 100%),
) !default;

// overlay
// Transitions
$transition-time: .3s !default;

// Overlay
$overlay-gradient: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .6) 100%) !default;

//accordion
Expand Down Expand Up @@ -308,7 +311,6 @@ $badge-font-weight: $font-weight-medium !default;
$badge-empty-size: .5rem !default;

//buttons
$input-color: $body-color !default;
$input-btn-line-height: $line-height-base !default;
$input-btn-font-size: $font-size-base !default;
$input-btn-padding-y: .5rem - .0625rem !default;
Expand Down
8 changes: 4 additions & 4 deletions src/scss/layout/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Navbar toggler
width: 1.25em;
background: currentColor;
border-radius: 10px;
transition: $navbar-toggler-animation-time $navbar-toggler-animation-time top, $navbar-toggler-animation-time $navbar-toggler-animation-time bottom, $navbar-toggler-animation-time transform, 0s $navbar-toggler-animation-time opacity;
@include transition(top $navbar-toggler-animation-time $navbar-toggler-animation-time, bottom $navbar-toggler-animation-time $navbar-toggler-animation-time, transform $navbar-toggler-animation-time, opacity 0s $navbar-toggler-animation-time);
position: relative;

&:before,
Expand All @@ -304,7 +304,7 @@ Navbar toggler
background: inherit;
position: absolute;
left: 0;
transition: inherit;
@include transition(inherit);
}

&:before {
Expand All @@ -317,7 +317,7 @@ Navbar toggler

.navbar-toggler[aria-expanded="true"] & {
transform: rotate(45deg);
transition: .3s top, .3s bottom, .3s .3s transform, 0s .3s opacity;
@include transition(top $transition-time, bottom $transition-time, transform $transition-time $transition-time, opacity 0s $transition-time);

&:before {
top: 0;
Expand Down Expand Up @@ -390,7 +390,7 @@ Navbar vertical
bottom: 0;
z-index: $zindex-fixed;
align-items: flex-start;
transition: .3s transform;
@include transition(transform $transition-time);
overflow-x: auto;

&.navbar-right {
Expand Down
2 changes: 1 addition & 1 deletion src/scss/mixins/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
&::-webkit-scrollbar {
width: 6px;
height: 6px;
transition: .3s background;
@include transition(background $transition-time);
}

&::-webkit-scrollbar-thumb {
Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/_avatars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
border: 1px dashed $border-color;
background: $form-check-input-bg;
flex-direction: column;
transition: .3s color, .3s background-color;
@include transition(color $transition-time, background-color $transition-time);

svg {
width: 1.5rem;
Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/_calendars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
border: 1px solid transparent;
border-radius: $border-radius-pill;
outline: 0;
transition: background .3s, border .3s, box-shadow .32s, color .3s;
@include transition(background $transition-time, border $transition-time, box-shadow .32s, color $transition-time);

&:hover {
color: $primary;
Expand Down
4 changes: 2 additions & 2 deletions src/scss/ui/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@at-root a#{&} {
color: inherit;
transition: .3s box-shadow;
@include transition(box-shadow $transition-time);

&:hover {
text-decoration: none;
Expand Down Expand Up @@ -94,7 +94,7 @@
justify-content: center;
padding: $card-spacer-y $card-spacer-x;
text-align: center;
transition: .3s background;
@include transition(background $transition-time);
border-top: 1px solid $border-color;
flex: 1;
color: inherit;
Expand Down
4 changes: 2 additions & 2 deletions src/scss/ui/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Form help
user-select: none;
background: $min-white;
border-radius: $border-radius-pill;
transition: .3s background-color, .3s color;
@include transition(background-color $transition-time, color $transition-time);

&:hover,
&[aria-describedby] {
Expand Down Expand Up @@ -199,7 +199,7 @@ Input group

.input-group-text {
background: transparent;
transition: $input-transition;
@include transition($input-transition);

&:first-child {
padding-right: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
.list-group-hoverable {
.list-group-item-actions {
opacity: 0;
transition: .3s opacity;
@include transition(opacity $transition-time);
}

.list-group-item:hover .list-group-item-actions,
Expand Down
4 changes: 2 additions & 2 deletions src/scss/ui/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@

.nav-link {
display: flex;
transition: .3s color;
@include transition(color $transition-time);
align-items: center;
}

.nav-link-toggle {
margin-left: auto;
padding: 0 .25rem;
transition: .3s transform;
@include transition(transform $transition-time);
@include caret();

&:after {
Expand Down
10 changes: 5 additions & 5 deletions src/scss/ui/_switch-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
.switch-icon-fade {
.switch-icon-a,
.switch-icon-b {
transition: opacity .5s;
@include transition(opacity .5s);
}
}

// Scale variant
.switch-icon-scale {
.switch-icon-a,
.switch-icon-b {
transition: opacity .5s, transform .0s .5s;
@include transition(opacity .5s, transform .0s .5s);
}

.switch-icon-b {
Expand All @@ -75,7 +75,7 @@
&.active {
.switch-icon-a,
.switch-icon-b {
transition: opacity .0s, transform .5s;
@include transition(opacity .0s, transform .5s);
}

.switch-icon-b {
Expand All @@ -92,7 +92,7 @@
.switch-icon-b {
backface-visibility: hidden;
transform-style: preserve-3d;
transition: opacity 0s .2s, transform .4s ease-in-out;
@include transition(opacity 0s .2s, transform .4s ease-in-out);
}

.switch-icon-a {
Expand Down Expand Up @@ -127,7 +127,7 @@

.switch-icon-a,
.switch-icon-b {
transition: opacity .3s, transform .3s;
@include transition(opacity $transition-time, transform $transition-time);
}

.switch-icon-a {
Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/forms/_form-check.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Form check
margin-top: ($form-check-min-height - $form-check-input-width) * .5;

.form-switch & {
transition: .3s background-color, .3s background-position;
@include transition(background-color$transition-time, background-position $transition-time);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/forms/_form-colorinput.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Color Input
background: no-repeat center center/$form-check-input-checked-bg-size;
background-image: escape-svg($form-check-input-checked-bg-image);
opacity: 0;
transition: .3s opacity;
@include transition(opacity $transition-time);

.form-colorinput-input:checked ~ & {
opacity: 1;
Expand Down
6 changes: 3 additions & 3 deletions src/scss/ui/forms/_form-imagecheck.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Image check
background: $white;
border: 1px solid $border-color;
border-radius: 3px;
transition: .3s opacity;
@include transition(opacity $transition-time);

.form-imagecheck-input:checked ~ & {
background-color: $form-check-input-checked-bg-color;
Expand All @@ -62,7 +62,7 @@ Image check
max-width: 100%;
display: block;
opacity: .64;
transition: .3s opacity;
@include transition(opacity $transition-time);

&:first-child {
border-top-left-radius: 2px;
Expand All @@ -86,7 +86,7 @@ Image check
font-size: $font-size-sm;
color: $text-muted;
text-align: center;
transition: .3s color;
@include transition(color $transition-time);

.form-imagecheck:hover &,
.form-imagecheck-input:focus ~ .form-imagecheck-figure &,
Expand Down
2 changes: 1 addition & 1 deletion src/scss/ui/forms/_form-selectgroup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Select group
user-select: none;
border: 1px solid $input-border-color;
border-radius: 3px;
transition: border-color .3s, background .3s, color .3s;
@include transition(border-color $transition-time, background $transition-time, color $transition-time);

.icon:only-child {
margin: 0 -.25rem;
Expand Down
2 changes: 1 addition & 1 deletion src/scss/vendor/_litepicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.day-item {
cursor: pointer !important;
padding: .5rem 0 !important;
transition: .3s color, .3s background-color, .3s border-color;
@include transition(color $transition-time, background-color $transition-time, border-color $transition-time);
}
}

Expand Down

0 comments on commit d1e2282

Please sign in to comment.