Skip to content

Commit f2cebf6

Browse files
site: remove unnecessary animation logic
1 parent 4481a2f commit f2cebf6

File tree

1 file changed

+5
-10
lines changed
  • packages/ui-components/src/Providers/NotificationProvider

1 file changed

+5
-10
lines changed

packages/ui-components/src/Providers/NotificationProvider/index.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,20 @@ export const useNotification = () => useContext(NotificationDispatch);
2727

2828
export const NotificationProvider: FC<PropsWithChildren> = ({ children }) => {
2929
const [notification, dispatch] = useState<NotificationContextType>(null);
30-
const [isOpen, setIsOpen] = useState(false);
3130

3231
useEffect(() => {
33-
if (notification) {
34-
setIsOpen(true);
35-
const timeout = setTimeout(() => {
36-
setIsOpen(false);
37-
}, notification.duration);
38-
return () => clearTimeout(timeout);
39-
}
32+
const timeout = setTimeout(() => dispatch(null), notification?.duration);
33+
34+
return () => clearTimeout(timeout);
4035
}, [notification]);
4136

4237
return (
4338
<NotificationContext.Provider value={notification}>
4439
<NotificationDispatch.Provider value={dispatch}>
45-
<Toast.Provider swipeDirection="right">
40+
<Toast.Provider>
4641
{children}
4742
{notification && (
48-
<Notification open={isOpen} duration={notification.duration}>
43+
<Notification duration={notification.duration}>
4944
{notification.message}
5045
</Notification>
5146
)}

0 commit comments

Comments
 (0)