1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-06-05 07:38:47 +00:00

Merge pull request #271 from trezor/modal-fade

Modal fade animation
This commit is contained in:
Vladimir Volek 2018-12-12 14:20:46 +01:00 committed by GitHub
commit f447774186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 17 deletions

View File

@ -1,10 +1,10 @@
/* @flow */ /* @flow */
import * as React from 'react'; import * as React from 'react';
import { CSSTransition } from 'react-transition-group';
import styled from 'styled-components'; import styled from 'styled-components';
import colors from 'config/colors'; import colors from 'config/colors';
import { FADE_IN } from 'config/animations';
import { UI } from 'trezor-connect'; import { UI } from 'trezor-connect';
import * as MODAL from 'actions/constants/modal'; import * as MODAL from 'actions/constants/modal';
@ -31,15 +31,6 @@ import Stellar from 'components/modals/external/Stellar';
import type { Props } from './Container'; import type { Props } from './Container';
const Fade = (props: { children: React.Node}) => (
<CSSTransition
{...props}
timeout={1000}
classNames="fade"
>{ props.children }
</CSSTransition>
);
const ModalContainer = styled.div` const ModalContainer = styled.div`
position: fixed; position: fixed;
z-index: 10000; z-index: 10000;
@ -53,6 +44,7 @@ const ModalContainer = styled.div`
align-items: center; align-items: center;
overflow: auto; overflow: auto;
padding: 20px; padding: 20px;
animation: ${FADE_IN} 0.3s;
`; `;
const ModalWindow = styled.div` const ModalWindow = styled.div`
@ -192,13 +184,11 @@ const Modal = (props: Props) => {
} }
return ( return (
<Fade key="modal-fade">
<ModalContainer> <ModalContainer>
<ModalWindow> <ModalWindow>
{ component } { component }
</ModalWindow> </ModalWindow>
</ModalContainer> </ModalContainer>
</Fade>
); );
}; };

View File

@ -57,3 +57,12 @@ export const PULSATE = keyframes`
opacity: 1.0; opacity: 1.0;
} }
`; `;
export const FADE_IN = keyframes`
0% {
opacity: 0;
}
100% {
opacity: 1;
}
`;