UNPKG

rap-react

Version:

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

47 lines (46 loc) 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.ShowMessage = void 0; var _reactToastify = require("react-toastify"); require("react-toastify/dist/ReactToastify.css"); const ShowMessage = function (message) { let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; let title = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ""; let showAtBottom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; const position = showAtBottom === true ? _reactToastify.toast.POSITION.BOTTOM_CENTER : _reactToastify.toast.POSITION.TOP_RIGHT; switch (type) { case -2: { _reactToastify.toast.error(message, { position: position }); break; } case -1: { _reactToastify.toast.warn(message, { position: position }); break; } case 0: { _reactToastify.toast.info(message, { position: position }); break; } case 1: default: { _reactToastify.toast.success(message, { position: position, className: "toast-success" }); } } }; exports.ShowMessage = ShowMessage; var _default = exports.default = ShowMessage;