UNPKG

rap-react

Version:

To make it easy for you to get started with GitLab, here's a list of recommended next steps.

37 lines (33 loc) 804 B
import { toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; export const ShowMessage = (message, type = 1, title = "", showAtBottom = false) => { const position = showAtBottom === true ? toast.POSITION.BOTTOM_CENTER: toast.POSITION.TOP_RIGHT; switch (type) { case -2: { toast.error(message, { position: position, }); break; } case -1: { toast.warn(message, { position: position, }); break; } case 0: { toast.info(message, { position: position, }); break; } case 1: default: { toast.success(message, { position: position, className: "toast-success", }); } } }; export default ShowMessage;