MyCrypto/common/containers/TabSection/Notifications.tsx
James Prado 2075a416ae Animate transaction notifications & fix styles (#305)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Add react-transition-group

* Animate notifications with react-transition-group

* Identify issue with notifications getting overridden

* Update RTG (react-transition-group) to v2 & identify keys as animation issue

* Add unique id on successful transactions for unique keys

* update classNames, remove unused import

* Revert removing lodash

* Remove unnecessary test util

* Remove formatting noise

* Remove all formatting noise

* Update CSS & Change notification unique id

* Add unique id for each notification
2017-11-06 22:20:19 -08:00

49 lines
1.2 KiB
TypeScript

import {
closeNotification,
Notification,
TCloseNotification
} from 'actions/notifications';
import React from 'react';
import { connect } from 'react-redux';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
import NotificationRow from './NotificationRow';
import './Notifications.scss';
interface Props {
notifications: Notification[];
closeNotification: TCloseNotification;
}
const Transition = props => (
<CSSTransition
{...props}
classNames="NotificationAnimation"
timeout={{ enter: 500, exit: 500 }}
/>
);
export class Notifications extends React.Component<Props, {}> {
public render() {
return (
<TransitionGroup className="Notifications">
{this.props.notifications.map(n => {
return (
<Transition key={n.id}>
<NotificationRow
notification={n}
onClose={this.props.closeNotification}
/>
</Transition>
);
})}
</TransitionGroup>
);
}
}
const mapStateToProps = state => ({
notifications: state.notifications
});
export default connect(mapStateToProps, { closeNotification })(Notifications);