diff options
author | Kadinsky <kandinsky454@protonmail.ch> | 2018-10-18 18:12:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-18 18:12:24 +0800 |
commit | d0df0747217dca230aadbee72337d7111a1383e7 (patch) | |
tree | 4df7d1a0fd40f7e953af595ddac9f9b7c4aec0d3 /packages/instant/src/components/animations/slide_animations.tsx | |
parent | 376034ac7e2053ea81aa637983d1f6a7e61588d9 (diff) | |
parent | 6ea386a7af89c1b8a4df94b656ae1772c29c1401 (diff) | |
download | dexon-0x-contracts-d0df0747217dca230aadbee72337d7111a1383e7.tar.gz dexon-0x-contracts-d0df0747217dca230aadbee72337d7111a1383e7.tar.zst dexon-0x-contracts-d0df0747217dca230aadbee72337d7111a1383e7.zip |
Merge pull request #1142 from 0xProject/feature/instant/asset-buyer-errors
[instant] Asset buyer errors
Diffstat (limited to 'packages/instant/src/components/animations/slide_animations.tsx')
-rw-r--r-- | packages/instant/src/components/animations/slide_animations.tsx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/instant/src/components/animations/slide_animations.tsx b/packages/instant/src/components/animations/slide_animations.tsx new file mode 100644 index 000000000..1f10a2ed6 --- /dev/null +++ b/packages/instant/src/components/animations/slide_animations.tsx @@ -0,0 +1,54 @@ +import * as React from 'react'; + +import { keyframes, styled } from '../../style/theme'; + +const slideKeyframeGenerator = (fromY: string, toY: string) => keyframes` + from { + position: relative; + top: ${fromY}; + } + + to { + position: relative; + top: ${toY}; + } +`; + +export interface SlideAnimationProps { + keyframes: string; + animationType: string; + animationDirection?: string; +} + +export const SlideAnimation = + styled.div < + SlideAnimationProps > + ` + animation-name: ${props => props.keyframes}; + animation-duration: 0.3s; + animation-timing-function: ${props => props.animationType}; + animation-delay: 0s; + animation-iteration-count: 1; + animation-fill-mode: ${props => props.animationDirection || 'none'}; + position: relative; +`; + +export interface SlideAnimationComponentProps { + downY: string; +} + +export const SlideUpAnimation: React.StatelessComponent<SlideAnimationComponentProps> = props => ( + <SlideAnimation animationType="ease-in" keyframes={slideKeyframeGenerator(props.downY, '0px')}> + {props.children} + </SlideAnimation> +); + +export const SlideDownAnimation: React.StatelessComponent<SlideAnimationComponentProps> = props => ( + <SlideAnimation + animationDirection="forwards" + animationType="cubic-bezier(0.25, 0.1, 0.25, 1)" + keyframes={slideKeyframeGenerator('0px', props.downY)} + > + {props.children} + </SlideAnimation> +); |