From 32fb17de8f78317b165b6f269a8bab2d4e852d0d Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Mon, 30 May 2022 20:08:04 -0500 Subject: Fix axios and add new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FIX logica de aƱadiir (ok) - FIX axios y dispatch fuera de un componente (ok) - Cambiar las notificaciones --- .../app/components/Notification/Notification.js | 69 +++++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) (limited to 'front/odiparpack/app/components/Notification/Notification.js') diff --git a/front/odiparpack/app/components/Notification/Notification.js b/front/odiparpack/app/components/Notification/Notification.js index 7e73896..fcc53a4 100644 --- a/front/odiparpack/app/components/Notification/Notification.js +++ b/front/odiparpack/app/components/Notification/Notification.js @@ -2,8 +2,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import CloseIcon from '@material-ui/icons/Close'; +import classNames from 'classnames'; +import CheckCircleOutlinedIcon from '@material-ui/icons/CheckCircleOutlined'; +import ErrorOutlineOutlinedIcon from '@material-ui/icons/ErrorOutlineOutlined'; +import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined'; +import ReportProblemOutlinedIcon from '@material-ui/icons/ReportProblemOutlined'; -import { Snackbar, IconButton } from '@material-ui/core'; +import { Snackbar, IconButton, SnackbarContent } from '@material-ui/core'; const styles = theme => ({ close: { @@ -11,6 +16,41 @@ const styles = theme => ({ }, }); +const variantIcon = { + success: CheckCircleOutlinedIcon, + warning: ReportProblemOutlinedIcon, + error: ErrorOutlineOutlinedIcon, + info: InfoOutlinedIcon, +}; + +const styles1 = theme => ({ + success: { + backgroundColor: '#b6f8c4', + }, + error: { + backgroundColor: '#faabab', + }, + info: { + backgroundColor: '#b2e7f5', + }, + warning: { + backgroundColor: '#f5ea9f', + }, + icon: { + fontSize: 20, + color: 'black' + }, + iconVariant: { + opacity: 0.9, + marginRight: theme.spacing(1), + }, + message: { + display: 'flex', + alignItems: 'center', + color: 'black' + }, +}); + class Notification extends React.Component { handleClose = (event, reason) => { if (reason === 'clickaway') { @@ -20,20 +60,30 @@ class Notification extends React.Component { }; render() { - const { classes, message } = this.props; + const { classes, message, variant } = this.props; + const Icon = variantIcon[variant]; return ( this.handleClose()} ContentProps={{ 'aria-describedby': 'message-id', }} - message={message} + anchorOrigin={{ + vertical: 'top', + horizontal: 'right', + }} + + > + + + {message} + + )} action={[ this.handleClose()} > - + , ]} /> + ); } } @@ -56,4 +107,4 @@ Notification.propTypes = { message: PropTypes.string.isRequired, }; -export default withStyles(styles)(Notification); +export default withStyles(styles1)(Notification); -- cgit v1.2.3