forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
34 lines (30 loc) · 772 Bytes
/
index.tsx
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
34
import * as ToastPrimitive from '@radix-ui/react-toast';
import classNames from 'classnames';
import type { FC } from 'react';
import styles from './index.module.css';
type NotificationProps = {
open?: boolean;
duration?: number;
onChange?: (value: boolean) => void;
children?: React.ReactNode;
className?: string;
};
const Notification: FC<NotificationProps> = ({
open,
duration = 5000,
onChange,
children,
className,
}: NotificationProps) => (
<ToastPrimitive.Root
open={open}
duration={duration}
onOpenChange={onChange}
className={classNames(styles.root, className)}
>
<ToastPrimitive.Title className={styles.message}>
{children}
</ToastPrimitive.Title>
</ToastPrimitive.Root>
);
export default Notification;