/* @flow */
'use strict';
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import * as NOTIFICATION from '../../actions/constants/notification';
export const Notification = (props: any) => {
const className = `notification ${ props.className }`;
const actionButtons = !props.actions ? null : props.actions.map((a, i) => {
return (
)
});
return (
{ props.cancelable ? (
) : null }
{ props.title }
{ props.message ? (
) : null }
{ props.actions && props.actions.length > 0 ? (
{ actionButtons }
) : null }
)
}
export const NotificationGroup = (props: any) => {
const { notifications, close } = props;
return notifications.map((n, i) => {
return (
)
});
}
export default connect(
(state) => {
return {
notifications: state.notifications
};
},
(dispatch) => {
return {
close: bindActionCreators((notif) => {
return {
type: NOTIFICATION.CLOSE,
payload: notif
}
}, dispatch),
};
}
)(NotificationGroup);