diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-31 07:57:42 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-31 07:57:42 +0800 |
commit | 91f8487947d7941b508c34d1bfc1e72c0840c33d (patch) | |
tree | f3382eda9cae53b2b61e9f2c3cd4690ce6d7cc52 /packages/instant/src/components/animations/slide_animation.tsx | |
parent | 4456c3ee14f5cd778e0d16ab42a3e2e34d102f23 (diff) | |
download | dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar.gz dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar.bz2 dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar.lz dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar.xz dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.tar.zst dexon-sol-tools-91f8487947d7941b508c34d1bfc1e72c0840c33d.zip |
feat: implement sliding panel
Diffstat (limited to 'packages/instant/src/components/animations/slide_animation.tsx')
-rw-r--r-- | packages/instant/src/components/animations/slide_animation.tsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/instant/src/components/animations/slide_animation.tsx b/packages/instant/src/components/animations/slide_animation.tsx new file mode 100644 index 000000000..4124e50c3 --- /dev/null +++ b/packages/instant/src/components/animations/slide_animation.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; + +import { PositionAnimation, PositionAnimationSettings } from './position_animation'; + +export type SlideAnimationState = 'slidIn' | 'slidOut' | 'none'; +export interface SlideAnimationProps { + position: string; + animationState: SlideAnimationState; + slideIn: PositionAnimationSettings; + slideOut: PositionAnimationSettings; +} + +export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = props => { + if (props.animationState === 'none') { + return <React.Fragment>{props.children}</React.Fragment>; + } + const propsToUse = props.animationState === 'slidIn' ? props.slideIn : props.slideOut; + return ( + <PositionAnimation position={props.position} {...propsToUse}> + {props.children} + </PositionAnimation> + ); +}; |