UNPKG

@boomerang-io/carbon-addons-boomerang-react

Version:
26 lines (23 loc) 983 B
import React from 'react'; import { toast } from 'react-toastify'; import { prefix } from '../../internal/settings.js'; import ToastNotification from './ToastNotification.js'; /* 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.createElement(ToastNotification, { title: notification })); toast(notificationComponent, { className: `${prefix}--bmrg--toast-container`, ...config, }); }; export { notify as default };