-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathNotification.tsx
More file actions
33 lines (27 loc) · 824 Bytes
/
Notification.tsx
File metadata and controls
33 lines (27 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { FC, ReactNode, useCallback } from 'react'
import { NotificationBanner } from './banner'
interface NotificationProps {
notification: {
icon?: ReactNode;
id: string;
message: string;
type: string;
}
onClose: (id: string, save?: boolean) => void
}
const Notification: FC<NotificationProps> = props => {
const handleClose = useCallback((save?: boolean) => {
props.onClose(props.notification.id, save)
}, [props.onClose, props.notification.id])
if (props.notification.type === 'banner') {
return (
<NotificationBanner
icon={props.notification.icon}
content={props.notification.message}
onClose={handleClose}
/>
)
}
return <></>
}
export default Notification