diff --git a/src/utils/use-notice.tsx b/src/utils/use-notice.tsx index 4999f05..26cab4c 100644 --- a/src/utils/use-notice.tsx +++ b/src/utils/use-notice.tsx @@ -1,6 +1,6 @@ import { useMemo, useState } from "react"; -import { IconButton, Slide, Snackbar } from "@mui/material"; -import { Close } from "@mui/icons-material"; +import { Box, IconButton, Slide, Snackbar } from "@mui/material"; +import { Close, CheckCircleRounded, ErrorRounded } from "@mui/icons-material"; interface NoticeInstance { info: (msg: string) => void; @@ -16,6 +16,17 @@ const useNotice = () => { if (reason !== "clickaway") setMessage(""); }; + const msgElement = + level === "info" ? ( + message + ) : ( + + {level === "error" && } + {level === "success" && } + {message} + + ); + const element = useMemo( () => ( { anchorOrigin={{ vertical: "top", horizontal: "right" }} autoHideDuration={3000} onClose={handleClose} - message={message} + message={msgElement} + sx={{ maxWidth: 360 }} TransitionComponent={(p) => } + transitionDuration={200} action={