2017-09-25 02:06:28 +00:00
|
|
|
import {
|
|
|
|
closeNotification,
|
|
|
|
Notification,
|
|
|
|
TCloseNotification
|
|
|
|
} from 'actions/notifications';
|
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import NotificationRow from './NotificationRow';
|
|
|
|
import './Notifications.scss';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
notifications: Notification[];
|
|
|
|
closeNotification: TCloseNotification;
|
|
|
|
}
|
|
|
|
export class Notifications extends React.Component<Props, {}> {
|
|
|
|
public render() {
|
|
|
|
if (!this.props.notifications.length) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div className="Notifications">
|
2017-10-04 04:13:49 +00:00
|
|
|
{this.props.notifications.map((n, i) => (
|
2017-09-25 02:06:28 +00:00
|
|
|
<NotificationRow
|
|
|
|
key={`${n.level}-${i}`}
|
|
|
|
notification={n}
|
|
|
|
onClose={this.props.closeNotification}
|
|
|
|
/>
|
2017-10-04 04:13:49 +00:00
|
|
|
))}
|
2017-09-25 02:06:28 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
notifications: state.notifications
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, { closeNotification })(Notifications);
|