mirror of
https://github.com/prymitive/karma
synced 2026-05-23 04:42:58 +00:00
feat(ui): allow disabling animations
This commit is contained in:
committed by
Łukasz Mierzwa
parent
d6029506d5
commit
45f30f6ce9
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user