forked from github/plane
feat: icon type added for toast alert
This commit is contained in:
parent
4cf121b914
commit
6d6478136a
@ -12,6 +12,7 @@ type ToastAlert = {
|
|||||||
title: string;
|
title: string;
|
||||||
message?: string;
|
message?: string;
|
||||||
type: "success" | "error" | "warning" | "info";
|
type: "success" | "error" | "warning" | "info";
|
||||||
|
iconType?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ReducerActionType = {
|
type ReducerActionType = {
|
||||||
@ -26,6 +27,7 @@ type ContextType = {
|
|||||||
title: string;
|
title: string;
|
||||||
type?: "success" | "error" | "warning" | "info" | undefined;
|
type?: "success" | "error" | "warning" | "info" | undefined;
|
||||||
message?: string | undefined;
|
message?: string | undefined;
|
||||||
|
iconType?: string | undefined;
|
||||||
}) => void;
|
}) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ export const ToastContextProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||||||
const removeAlert = useCallback((id: string) => {
|
const removeAlert = useCallback((id: string) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "REMOVE_TOAST_ALERT",
|
type: "REMOVE_TOAST_ALERT",
|
||||||
payload: { id, title: "", message: "", type: "success" },
|
payload: { id, title: "", message: "", type: "success", iconType: "" },
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -76,12 +78,13 @@ export const ToastContextProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||||||
title: string;
|
title: string;
|
||||||
type?: "success" | "error" | "warning" | "info";
|
type?: "success" | "error" | "warning" | "info";
|
||||||
message?: string;
|
message?: string;
|
||||||
|
iconType?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
const { title, type, message } = data;
|
const { title, type, message, iconType } = data;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "SET_TOAST_ALERT",
|
type: "SET_TOAST_ALERT",
|
||||||
payload: { id, title, message, type: type ?? "success" },
|
payload: { id, title, message, type: type ?? "success", iconType },
|
||||||
});
|
});
|
||||||
|
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user