The Node.js® Website
at main 34 lines 772 B view raw
1import * as ToastPrimitive from '@radix-ui/react-toast'; 2import classNames from 'classnames'; 3import type { FC } from 'react'; 4 5import styles from './index.module.css'; 6 7type NotificationProps = { 8 open?: boolean; 9 duration?: number; 10 onChange?: (value: boolean) => void; 11 children?: React.ReactNode; 12 className?: string; 13}; 14 15const Notification: FC<NotificationProps> = ({ 16 open, 17 duration = 5000, 18 onChange, 19 children, 20 className, 21}: NotificationProps) => ( 22 <ToastPrimitive.Root 23 open={open} 24 duration={duration} 25 onOpenChange={onChange} 26 className={classNames(styles.root, className)} 27 > 28 <ToastPrimitive.Title className={styles.message}> 29 {children} 30 </ToastPrimitive.Title> 31 </ToastPrimitive.Root> 32); 33 34export default Notification;