-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VNotifications.tsx
32 lines (29 loc) · 953 Bytes
/
VNotifications.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
import './styles.css';
import { TransitionGroup, defineComponent } from 'vue';
import { VNotification } from '../VNotification';
import { useNotify } from '@f3ve/vue-notify-store';
export const VNotifications = defineComponent(
(props: { notifyComponent?: any; delay?: number }) => {
const notify = useNotify();
const Notification = props.notifyComponent || VNotification;
const delay = props.delay !== undefined ? props.delay : 3500;
return () => (
<div class="notifications">
<TransitionGroup name="notifications">
{notify.notifications.map((notification, index) => (
<Notification
color={notification.color}
message={notification.message}
index={index}
key={notification.id}
delay={delay}
/>
))}
</TransitionGroup>
</div>
);
},
{
props: ['notifyComponent', 'delay'],
},
);