2017-09-24 19:06:28 -07:00
|
|
|
import { ReactElement } from 'react';
|
|
|
|
import { TypeKeys } from './constants';
|
|
|
|
/*** Shared types ***/
|
|
|
|
export type NOTIFICATION_LEVEL = 'danger' | 'warning' | 'success' | 'info';
|
|
|
|
|
|
|
|
export interface Notification {
|
|
|
|
level: NOTIFICATION_LEVEL;
|
|
|
|
msg: ReactElement<any> | string;
|
2017-11-06 22:20:19 -08:00
|
|
|
id: number;
|
2017-11-28 16:17:26 -08:00
|
|
|
duration?: number;
|
2017-09-24 19:06:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Close notification ***/
|
|
|
|
export interface CloseNotificationAction {
|
|
|
|
type: TypeKeys.CLOSE_NOTIFICATION;
|
|
|
|
payload: Notification;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Show Notification ***/
|
|
|
|
export interface ShowNotificationAction {
|
|
|
|
type: TypeKeys.SHOW_NOTIFICATION;
|
|
|
|
payload: Notification;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Union Type ***/
|
|
|
|
export type NotificationsAction =
|
|
|
|
| ShowNotificationAction
|
|
|
|
| CloseNotificationAction;
|