You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
688 B

  1. import { connect } from 'react-redux';
  2. import { NotificationStack } from 'react-notification';
  3. import { dismissNotification } from '../../../actions/notifications';
  4. const mapStateToProps = (state, props) => {
  5. return {
  6. notifications: state.get('notifications').map((item, i) => ({
  7. message: item.get('message'),
  8. title: item.get('title'),
  9. key: i,
  10. action: 'Dismiss',
  11. dismissAfter: 5000
  12. })).toJS()
  13. };
  14. };
  15. const mapDispatchToProps = (dispatch) => {
  16. return {
  17. onDismiss: notifiction => {
  18. dispatch(dismissNotification(notifiction));
  19. }
  20. };
  21. };
  22. export default connect(mapStateToProps, mapDispatchToProps)(NotificationStack);