Simplified toast function call

This commit is contained in:
Daniel Cojocea committed 2024-07-18 10:43:46 -04:00
1 parent 783d745181
commit 5150179193
8 files changed
+9 -61

No files matched your search

+9 -3
View File
@@ -11,7 +11,13 @@ import Alert from "../Components/Alert";
* @param {object} [props.config] - Additional configuration props for the toast.
*/
export const createToast = ({ variant, title, body, hasIcon, config = {} }) => {
export const createToast = ({
variant = "info",
title,
body,
hasIcon = false,
config = {},
}) => {
const toastConfig = {
position: "bottom-right",
autoClose: 3000,
@@ -36,9 +42,9 @@ export const createToast = ({ variant, title, body, hasIcon, config = {} }) => {
};
createToast.propTypes = {
variant: PropTypes.oneOf(["info", "error", "warning"]).isRequired,
variant: PropTypes.oneOf(["info", "error", "warning"]),
title: PropTypes.string,
body: PropTypes.string,
body: PropTypes.string.isRequired,
hasIcon: PropTypes.bool,
config: PropTypes.object,
};