initial docker setup
This commit is contained in:
36
frontend/src/mainComponents/notification/NotificationBox.jsx
Normal file
36
frontend/src/mainComponents/notification/NotificationBox.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React, {Component} from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {ToastContainer, toast} from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.min.css';
|
||||
import {destroyMessage} from '../../actions/notification/notificationActions';
|
||||
import './notificationBox.css';
|
||||
|
||||
class NotificationBox extends Component {
|
||||
|
||||
render() {
|
||||
const {messages} = this.props;
|
||||
const messagesJson = messages && messages.messageJson;
|
||||
const messageObject = messages && messages.messageObj;
|
||||
|
||||
if (messagesJson && messagesJson.length) {
|
||||
messagesJson.forEach(messageObj => {
|
||||
let messageTranslated = (messageObject && messageObject[messageObj.message]) ? messageObject[messageObj.message] : messageObj.message;
|
||||
messageTranslated += messageObj.key ? ' ' + messageObj.key : '';
|
||||
toast[messageObj.code](messageTranslated);
|
||||
this.props.dispatch(destroyMessage());
|
||||
})
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<ToastContainer className="generic-banner-box" position="top-right"
|
||||
autoClose={5000}
|
||||
hideProgressBar={false}
|
||||
newestOnTop={true}
|
||||
closeOnClick={true}
|
||||
pauseOnHover={true}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect()(NotificationBox);
|
||||
@@ -0,0 +1,23 @@
|
||||
@import '../../styleConstants.scss';
|
||||
|
||||
.generic-banner-box {
|
||||
top: 7rem;
|
||||
|
||||
.toastify-content--success {
|
||||
background: $greenColor;
|
||||
border-color: $borderColor;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.toastify-content--error {
|
||||
background: $redColor;
|
||||
border-color: $borderColor;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.toastify-content--warning {
|
||||
background: $warning;
|
||||
border-color: $borderColor;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user