-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the timeout issue in notifcations wrapper
- Loading branch information
1 parent
3e8f459
commit 2dc6c75
Showing
4 changed files
with
32 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...bs/kode-ui/src/patterns/SideBarLayout/components/NotificationSlot/NotificationWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { FC, PropsWithChildren } from 'react'; | ||
import React, { useEffect } from 'react'; | ||
import type { INotificationMinimizedProps } from '../LayoutProvider/NotificationsProvider'; | ||
import { useNotifications } from '../LayoutProvider/NotificationsProvider'; | ||
import { Notification } from './../../../../components'; | ||
|
||
type IProps = PropsWithChildren & INotificationMinimizedProps; | ||
|
||
export const NotificationWrapper: FC<IProps> = ({ children, ...props }) => { | ||
const { removeNotification } = useNotifications(); | ||
|
||
useEffect(() => { | ||
if (!props.isDismissable) { | ||
setTimeout(() => { | ||
removeNotification(props); | ||
}, 12000); | ||
} | ||
}, []); | ||
|
||
return <Notification {...props}>{children}</Notification>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters