diff --git a/frontend/src/components/toast/Toast.jsx b/frontend/src/components/toast/Toast.jsx index 82d8fc0..ad2681a 100644 --- a/frontend/src/components/toast/Toast.jsx +++ b/frontend/src/components/toast/Toast.jsx @@ -1,38 +1,48 @@ -import {useCallback} from "react"; -import {Alert, Snackbar} from "@mui/material"; +import { useCallback } from 'react'; +import { Close } from '@mui/icons-material'; +import { IconButton, Snackbar, SnackbarContent } from '@mui/material'; import Slide from '@mui/material/Slide'; -export default function Toast({ - duration = 6000, - vertical = "top", //'top', 'bottom' - horizontal = "right", //'left', 'center', 'right' - message = "fill me", - alertType = "success",//'error', 'warning', 'info', 'success', - open, - setOpen, - }) { +const CloseButton = ({ onClick }) => ( + + + +); +const alertTypeColorMapping = { + error: 'var(--error-color)', + warning: 'var(--warn-color)', + info: 'var(--info-color)', + success: 'var(--success-color)', +}; - const onClose = useCallback(() => { - setOpen(false) - }, []) +export default function Toast({ + duration = 6000, + vertical = 'top', //'top', 'bottom' + horizontal = 'right', //'left', 'center', 'right' + message = 'fill me', + alertType = 'success', //'error', 'warning', 'info', 'success', + open, + setOpen, +}) { + const onClose = useCallback(() => { + setOpen(false); + }, []); - return ( - } - > - - {message} - - - ) -} \ No newline at end of file + return ( + } + action={} + > + setOpen(false)} />} + sx={{ bgcolor: alertTypeColorMapping[alertType], color: 'var(--light-text-color)' }} + /> + + ); +} diff --git a/frontend/src/css/Theme.css b/frontend/src/css/Theme.css index 6baa538..0d73f72 100644 --- a/frontend/src/css/Theme.css +++ b/frontend/src/css/Theme.css @@ -10,6 +10,8 @@ /*warn color*/ --warn-color: #ec6803; --error-color: #ff3333; + --success-color: #197f3c; + --info-color: #19517f; /*background*/ --background-color: #0a0f26;