update toastUtils to use Toast component

This commit is contained in:
Alex Holliday committed 2025-07-16 10:33:06 -07:00
1 parent 616927d388
commit c58801f6f7
1 file changed
+6 -4
+6 -4
View File
@@ -1,7 +1,6 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { toast, Slide } from "react-toastify"; import { toast, Slide } from "react-toastify";
import Alert from "../Components/Alert"; import Toast from "../Components/Toast";
/** /**
* @param {object} props * @param {object} props
* @param {'info' | 'error' | 'warning'} - The variant of the alert (e.g., "info", "error"). * @param {'info' | 'error' | 'warning'} - The variant of the alert (e.g., "info", "error").
@@ -15,6 +14,7 @@ export const createToast = ({
variant = "info", variant = "info",
title, title,
body, body,
hasDismiss = false,
hasIcon = false, hasIcon = false,
config = {}, config = {},
}) => { }) => {
@@ -29,13 +29,14 @@ export const createToast = ({
toast( toast(
({ closeToast }) => ( ({ closeToast }) => (
<Alert <Toast
variant={variant} variant={variant}
title={title} title={title}
body={body} body={body}
isToast={true} isToast={true}
hasIcon={hasIcon}
onClick={closeToast} onClick={closeToast}
hasDismiss={hasDismiss}
hasIcon={hasIcon}
/> />
), ),
toastConfig toastConfig
@@ -47,5 +48,6 @@ createToast.propTypes = {
title: PropTypes.string, title: PropTypes.string,
body: PropTypes.string.isRequired, body: PropTypes.string.isRequired,
hasIcon: PropTypes.bool, hasIcon: PropTypes.bool,
hasDismiss: PropTypes.bool,
config: PropTypes.object, config: PropTypes.object,
}; };