Skip to content

Instantly share code, notes, and snippets.

@smddzcy
Created November 6, 2019 15:55
Show Gist options
  • Save smddzcy/1e7dbf31ee39b3ab59d8185880b1d509 to your computer and use it in GitHub Desktop.
Save smddzcy/1e7dbf31ee39b3ab59d8185880b1d509 to your computer and use it in GitHub Desktop.
react-transition-group SASS Mixin
@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