@boomerang-io/carbon-addons-boomerang-react
Version:
Carbon Addons for Boomerang apps
34 lines (27 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
var reactToastify = require('react-toastify');
var settings = require('../../internal/settings.js');
var ToastNotification = require('./ToastNotification.js');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var React__default = /*#__PURE__*/_interopDefault(React);
/*
IBM Confidential
694970X, 69497O0
© Copyright IBM Corp. 2022, 2024
*/
/** Create notifcation wrapper around react-toastify with default component for basic notification
* @param {*} notification notifcation content
* @param {Object} config custom configuration for ToastContainer
*/
const notify = (notification, config) => {
// Check to see if they pass in a component or function
// Default passing prop to Notification component
const notificationComponent = typeof notification === "object" || typeof notification === "function" ? (notification) : (React__default.default.createElement(ToastNotification.default, { title: notification }));
reactToastify.toast(notificationComponent, {
className: `${settings.prefix}--bmrg--toast-container`,
...config,
});
};
exports.default = notify;