From ad4ba7b6f76e58bf355b51d851e57d3e390914b0 Mon Sep 17 00:00:00 2001 From: Fadi Khadra Date: Fri, 4 Aug 2023 15:58:26 +0200 Subject: [PATCH] fix progress --- src/components/ToastContainer.tsx | 12 ++++++++---- src/hooks/useToast.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ToastContainer.tsx b/src/components/ToastContainer.tsx index 9efbbc04..92c10a19 100644 --- a/src/components/ToastContainer.tsx +++ b/src/components/ToastContainer.tsx @@ -53,8 +53,10 @@ export function ToastContainer(props: ToastContainerProps) { } function collapseAll() { - setIsCollapsed(true); - toast.play(); + if (stacked) { + setIsCollapsed(true); + toast.play(); + } } useLayoutEffect(() => { @@ -94,8 +96,10 @@ export function ToastContainer(props: ToastContainerProps) { className={Default.CSS_NAMESPACE as string} id={containerId as string} onMouseEnter={() => { - setIsCollapsed(false); - toast.pause(); + if (stacked) { + setIsCollapsed(false); + toast.pause(); + } }} onMouseLeave={collapseAll} > diff --git a/src/hooks/useToast.ts b/src/hooks/useToast.ts index b06b58ef..db22c332 100644 --- a/src/hooks/useToast.ts +++ b/src/hooks/useToast.ts @@ -167,7 +167,7 @@ export function useToast(props: ToastProps) { eventHandlers.onMouseEnter = pauseToast; // progress control is delegated to the container - if (props.stacked === false) eventHandlers.onMouseLeave = playToast; + if (!props.stacked) eventHandlers.onMouseLeave = playToast; } // prevent toast from closing when user drags the toast