aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-16 04:33:30 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-16 04:33:30 +0800
commit20d60e2368b361e5055ddded9858cd11795b84d0 (patch)
tree5c9853475b72e9db926f401d4d0ac64532173be2 /packages/instant/src/components
parent58ad7d7caf475309dbd4e4486a1ed43404d5193c (diff)
downloaddexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar.gz
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar.bz2
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar.lz
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar.xz
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.tar.zst
dexon-sol-tools-20d60e2368b361e5055ddded9858cd11795b84d0.zip
dont need constructor just to set state
git status
Diffstat (limited to 'packages/instant/src/components')
-rw-r--r--packages/instant/src/components/animations/slide_up_and_down_animation.tsx20
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);