UNPKG

react-js-plugins

Version:

A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.

29 lines (28 loc) 1.22 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { getHook } from './chunk22124'; var Snackbar = function (_a) { var type = _a.type, msg = _a.msg, duration = _a.duration; var _b = getHook('snackBar'), enqueueSnackbar = _b.enqueueSnackbar, closeSnackbar = _b.closeSnackbar; if (msg !== undefined && msg !== '') { enqueueSnackbar(msg !== null && msg !== void 0 ? msg : '', { anchorOrigin: { // @shivaji perpose dyanamic global alert. horizontal: 'right', vertical: 'top', }, variant: type, preventDuplicate: true, action: function (key) { return (_jsx("button", { onClick: function () { return closeSnackbar(key); }, "aria-label": "close", style: { background: 'transparent', border: 'none', color: '#fff', fontSize: '22px', cursor: 'pointer', marginLeft: '0px', }, children: "\u00D7" })); }, autoHideDuration: duration !== null && duration !== void 0 ? duration : 6000, }); } return null; }; export default Snackbar;