-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
75 lines (63 loc) · 1.88 KB
/
types.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// The types in this file are based on the DefinitelyTyped RNS file by:
// - Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// - Deividas Bakanas <https://github.com/DeividasBakanas>
// - Karol Janyst <https://github.com/LKay>
// - Bartosz Szewczyk <https://github.com/sztobar>
export type NotifyLevel = 'success' | 'warning' | 'error' | 'info'
export type NotifyPosition = 'tl' | 'tr' | 'tc' | 'bl' | 'br' | 'bc'
export type NotifyDismissable = 'button' | 'both' | 'none' | 'click' | boolean
export type NotifyCallback = (notification: NotifyOpts) => void
export interface NotifyOpts {
title?: string | JSX.Element
message?: string | JSX.Element
level?: NotifyLevel
position?: NotifyPosition
autoDismiss?: number
dismissible?: NotifyDismissable
action?: NotifyAction
children?: React.ReactNode
onAdd?: NotifyCallback
onRemove?: NotifyCallback
uid: number
data?: any
}
export interface NotifyAction {
label: string
callback?: () => void
}
export interface NotifyContainersStyle {
DefaultStyle: React.CSSProperties
tl?: React.CSSProperties
tr?: React.CSSProperties
tc?: React.CSSProperties
bl?: React.CSSProperties
br?: React.CSSProperties
bc?: React.CSSProperties
}
export interface NotifyItemStyle {
DefaultStyle?: React.CSSProperties
success?: React.CSSProperties
error?: React.CSSProperties
warning?: React.CSSProperties
info?: React.CSSProperties
}
export interface NotifyWrapperStyle {
DefaultStyle?: React.CSSProperties
}
export interface NotifyStyle {
Wrapper?: any
Containers?: NotifyContainersStyle
NotificationItem?: NotifyItemStyle
Title?: NotifyItemStyle
MessageWrapper?: NotifyWrapperStyle
Dismiss?: NotifyItemStyle
Action?: NotifyItemStyle
ActionWrapper?: NotifyWrapperStyle
}
export interface NotifyDispatch {
<T>(action: T): T
(action: any): any
}
export interface NotifyState {
notifications: NotifyOpts[]
}