fleet/frontend/components/FlashMessage/FlashMessage.jsx
Mike Stone 6ebc460b66 Admin user management (#233)
Admin user management page
2016-10-03 13:54:22 -04:00

44 lines
1.0 KiB
JavaScript

import React, { PropTypes } from 'react';
import radium from 'radium';
import componentStyles from './styles';
import { hideFlash } from '../../redux/nodes/notifications/actions';
const FlashMessage = ({ notification, dispatch }) => {
const { alertType, isVisible, message, undoAction } = notification;
const { containerStyles, contentStyles, undoStyles } = componentStyles;
const submitUndoAction = () => {
dispatch(undoAction);
dispatch(hideFlash);
return false;
};
const removeFlashMessage = () => {
dispatch(hideFlash);
return false;
};
if (!isVisible) return false;
return (
<div style={containerStyles(alertType)}>
<div style={contentStyles}>
{message}
</div>
<div onClick={submitUndoAction} style={undoStyles}>
Undo
</div>
<div onClick={removeFlashMessage}>
X
</div>
</div>
);
};
FlashMessage.propTypes = {
dispatch: PropTypes.func,
notification: PropTypes.object,
};
export default radium(FlashMessage);