Skip to content

Commit

Permalink
fix progress
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Aug 4, 2023
1 parent 147e6ac commit ad4ba7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/components/ToastContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ export function ToastContainer(props: ToastContainerProps) {
}

function collapseAll() {
setIsCollapsed(true);
toast.play();
if (stacked) {
setIsCollapsed(true);
toast.play();
}
}

useLayoutEffect(() => {
Expand Down Expand Up @@ -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}
>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad4ba7b

Please sign in to comment.