@pantheon-systems/design-toolkit-react
Version:
Pantheon's React Design Toolkit
33 lines (30 loc) • 943 B
JavaScript
import PropTypes from 'prop-types';
import { toast } from 'react-toastify';
import Toast from './Toast.js';
import { jsx } from 'react/jsx-runtime';
var Container = function Container(props) {
var children = props.children;
return /*#__PURE__*/jsx("div", {
children: children
});
};
Container.propTypes = {
children: PropTypes.node.isRequired
};
function useToast() {
var addToast = function addToast(type, message) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var iconAlt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
var toastContent = /*#__PURE__*/jsx(Container, {
children: /*#__PURE__*/jsx(Toast, {
iconAlt: iconAlt,
type: type,
children: message
})
});
return toast(toastContent, options);
};
return [addToast, toast];
}
export { useToast as default };
//# sourceMappingURL=useToast.js.map