Created
November 6, 2019 15:55
-
-
Save smddzcy/1e7dbf31ee39b3ab59d8185880b1d509 to your computer and use it in GitHub Desktop.
react-transition-group SASS Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin transition($childClasses, $enter, $normal, $exit, $transition, $transitionExit: null) { | |
@if not ($transitionExit) { | |
$transitionExit: $transition; | |
} | |
$split-values: str-split($childClasses, ", "); | |
@each $childClass in $split-values { | |
&-enter #{$childClass}, &-appear #{$childClass} { | |
@include list($enter); | |
} | |
&-enter-active #{$childClass}, &-enter-done #{$childClass}, &-exit #{$childClass} { | |
@include list($normal); | |
} | |
&-exit-active #{$childClass}, &-exit-done #{$childClass} { | |
@include list($exit); | |
} | |
&-enter-active #{$childClass}, &-appear-active #{$childClass} { | |
@include list($transition); | |
} | |
&-exit-active #{$childClass} { | |
@include list($transitionExit); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment