mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-07 14:10:13 +00:00
Format all files
This commit is contained in:
@@ -19,7 +19,7 @@ const actionTypes = {
|
||||
ADD_TOAST: "ADD_TOAST",
|
||||
UPDATE_TOAST: "UPDATE_TOAST",
|
||||
DISMISS_TOAST: "DISMISS_TOAST",
|
||||
REMOVE_TOAST: "REMOVE_TOAST",
|
||||
REMOVE_TOAST: "REMOVE_TOAST"
|
||||
} as const;
|
||||
|
||||
let count = 0;
|
||||
@@ -64,7 +64,7 @@ const addToRemoveQueue = (toastId: string) => {
|
||||
toastTimeouts.delete(toastId);
|
||||
dispatch({
|
||||
type: "REMOVE_TOAST",
|
||||
toastId: toastId,
|
||||
toastId: toastId
|
||||
});
|
||||
}, TOAST_REMOVE_DELAY);
|
||||
|
||||
@@ -76,7 +76,7 @@ export const reducer = (state: State, action: Action): State => {
|
||||
case "ADD_TOAST":
|
||||
return {
|
||||
...state,
|
||||
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
||||
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
|
||||
};
|
||||
|
||||
case "UPDATE_TOAST":
|
||||
@@ -84,7 +84,7 @@ export const reducer = (state: State, action: Action): State => {
|
||||
...state,
|
||||
toasts: state.toasts.map((t) =>
|
||||
t.id === action.toast.id ? { ...t, ...action.toast } : t
|
||||
),
|
||||
)
|
||||
};
|
||||
|
||||
case "DISMISS_TOAST": {
|
||||
@@ -106,22 +106,22 @@ export const reducer = (state: State, action: Action): State => {
|
||||
t.id === toastId || toastId === undefined
|
||||
? {
|
||||
...t,
|
||||
open: false,
|
||||
open: false
|
||||
}
|
||||
: t
|
||||
),
|
||||
)
|
||||
};
|
||||
}
|
||||
case "REMOVE_TOAST":
|
||||
if (action.toastId === undefined) {
|
||||
return {
|
||||
...state,
|
||||
toasts: [],
|
||||
toasts: []
|
||||
};
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
||||
toasts: state.toasts.filter((t) => t.id !== action.toastId)
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -145,7 +145,7 @@ function toast({ ...props }: Toast) {
|
||||
const update = (props: ToasterToast) =>
|
||||
dispatch({
|
||||
type: "UPDATE_TOAST",
|
||||
toast: { ...props, id },
|
||||
toast: { ...props, id }
|
||||
});
|
||||
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
||||
|
||||
@@ -157,14 +157,14 @@ function toast({ ...props }: Toast) {
|
||||
open: true,
|
||||
onOpenChange: (open) => {
|
||||
if (!open) dismiss();
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
id: id,
|
||||
dismiss,
|
||||
update,
|
||||
update
|
||||
};
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ function useToast() {
|
||||
...state,
|
||||
toast,
|
||||
dismiss: (toastId?: string) =>
|
||||
dispatch({ type: "DISMISS_TOAST", toastId }),
|
||||
dispatch({ type: "DISMISS_TOAST", toastId })
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user