feat(ui): allow disabling animations

This commit is contained in:
Łukasz Mierzwa
2020-10-11 16:27:33 +01:00
committed by Łukasz Mierzwa
parent d6029506d5
commit 45f30f6ce9
19 changed files with 318 additions and 65 deletions

View File

@@ -2,20 +2,26 @@ import React, { FC, ReactNode } from "react";
import { CSSTransition } from "react-transition-group";
import { ThemeContext } from "Components/Theme";
const DropdownSlide: FC<{
children: ReactNode;
in?: boolean;
unmountOnExit?: boolean;
}> = ({ children, ...props }) => (
<CSSTransition
classNames="components-animation-slide"
timeout={150}
appear={true}
exit={true}
{...props}
>
{children}
</CSSTransition>
);
}> = ({ children, ...props }) => {
const context = React.useContext(ThemeContext);
return (
<CSSTransition
classNames="components-animation-slide"
timeout={context.animations.duration ? 150 : 0}
appear={true}
exit={true}
{...props}
>
{children}
</CSSTransition>
);
};
export { DropdownSlide };