diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-16 04:33:30 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-16 04:33:30 +0800 |
commit | 20d60e2368b361e5055ddded9858cd11795b84d0 (patch) | |
tree | 5c9853475b72e9db926f401d4d0ac64532173be2 /packages/instant/src/components/animations | |
parent | 58ad7d7caf475309dbd4e4486a1ed43404d5193c (diff) | |
download | dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar.gz dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar.bz2 dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar.lz dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar.xz dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.tar.zst dexon-0x-contracts-20d60e2368b361e5055ddded9858cd11795b84d0.zip |
dont need constructor just to set state
git status
Diffstat (limited to 'packages/instant/src/components/animations')
-rw-r--r-- | packages/instant/src/components/animations/slide_up_and_down_animation.tsx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/instant/src/components/animations/slide_up_and_down_animation.tsx b/packages/instant/src/components/animations/slide_up_and_down_animation.tsx index da34b7485..05dda78be 100644 --- a/packages/instant/src/components/animations/slide_up_and_down_animation.tsx +++ b/packages/instant/src/components/animations/slide_up_and_down_animation.tsx @@ -36,6 +36,7 @@ export const SlideAnimation = export interface SlideAnimationComponentProps { downY: string; + children?: React.ReactNode; } export const SlideUpAnimationComponent: React.StatelessComponent<SlideAnimationComponentProps> = props => ( @@ -58,26 +59,27 @@ export interface SlideUpAndDownAnimationProps extends SlideAnimationComponentPro delayMs: number; } +enum SlideState { + Up = 'up', + Down = 'down', +} interface SlideUpAndDownState { - slideState: 'up' | 'down'; + slideState: SlideState; } export class SlideUpAndDownAnimation extends React.Component<SlideUpAndDownAnimationProps, SlideUpAndDownState> { + public state = { + slideState: SlideState.Up, + }; + private _timeoutId?: number; - constructor(props: SlideUpAndDownAnimationProps) { - super(props); - this._timeoutId = undefined; - this.state = { - slideState: 'up', - }; - } public render(): React.ReactNode { return this._renderSlide(); } public componentDidMount(): void { this._timeoutId = window.setTimeout(() => { this.setState({ - slideState: 'down', + slideState: SlideState.Down, }); }, this.props.delayMs); |