@trycourier/courier-react 8.0.4-beta → 8.0.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -5
- package/dist/hooks/use-courier.d.ts +2 -0
- package/dist/index.js +11 -1032
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3708 -27407
- package/dist/index.mjs.map +1 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @trycourier/courier-
|
|
1
|
+
# @trycourier/courier-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React UI components used to create an Inbox
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
```
|
|
8
|
-
npm i @trycourier/courier-react@8.0.
|
|
7
|
+
```bash
|
|
8
|
+
npm i @trycourier/courier-react@8.0.4-beta
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -26,10 +26,144 @@ function App() {
|
|
|
26
26
|
}, []);
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<CourierInbox
|
|
29
|
+
<CourierInbox
|
|
30
|
+
onMessageClick={(props) => {
|
|
31
|
+
console.log(props);
|
|
32
|
+
}}
|
|
33
|
+
onMessageActionClick={(props) => {
|
|
34
|
+
console.log(props);
|
|
35
|
+
}}
|
|
36
|
+
onMessageLongPress={(props) => {
|
|
37
|
+
console.log(props);
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
// or
|
|
42
|
+
|
|
43
|
+
<CourierInboxMenu
|
|
44
|
+
onMessageClick={(props) => {
|
|
45
|
+
console.log(props);
|
|
46
|
+
}}
|
|
47
|
+
onMessageActionClick={(props) => {
|
|
48
|
+
console.log(props);
|
|
49
|
+
}}
|
|
50
|
+
onMessageLongPress={(props) => {
|
|
51
|
+
console.log(props);
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
30
54
|
);
|
|
31
55
|
|
|
32
56
|
}
|
|
33
57
|
|
|
34
58
|
export default App;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Theme Customization
|
|
62
|
+
This allows you to style the prebuilt `<CourierInbox/>`. Tons of options live inside `CourierInboxTheme`. Command click in to see all options!
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { CourierInboxTheme } from '@trycourier/courier-ui-inbox';
|
|
66
|
+
|
|
67
|
+
const theme: CourierInboxTheme = {
|
|
68
|
+
popup: {
|
|
69
|
+
button: {
|
|
70
|
+
unreadIndicator: {
|
|
71
|
+
backgroundColor: '#9b4dca',
|
|
72
|
+
...
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
window: {
|
|
76
|
+
...
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
inbox: {
|
|
80
|
+
header: {
|
|
81
|
+
filters: {
|
|
82
|
+
unreadIndicator: {
|
|
83
|
+
backgroundColor: '#9b4dca',
|
|
84
|
+
...
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
list: {
|
|
89
|
+
item: {
|
|
90
|
+
unreadIndicatorColor: '#9b4dca',
|
|
91
|
+
...
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
<CourierInbox
|
|
100
|
+
height={'456px'}
|
|
101
|
+
mode='system'
|
|
102
|
+
feedType='archive'
|
|
103
|
+
lightTheme={theme}
|
|
104
|
+
darkTheme={theme}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
// or
|
|
108
|
+
|
|
109
|
+
<CourierInboxMenu
|
|
110
|
+
popupAlignment='top-left'
|
|
111
|
+
popupWidth='456px'
|
|
112
|
+
popupHeight='456px'
|
|
113
|
+
mode='system'
|
|
114
|
+
feedType='archive'
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Fully Custom UI Elements
|
|
120
|
+
You can change any element in the Inbox to be custom. Here are the available options.
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
<CourierInbox
|
|
124
|
+
renderHeader={(props) => {
|
|
125
|
+
return <div>...</div>
|
|
126
|
+
}}
|
|
127
|
+
renderListItem={(props) => {
|
|
128
|
+
return <div>...</div>
|
|
129
|
+
}}
|
|
130
|
+
renderEmptyState={(props) => {
|
|
131
|
+
return <div>...</div>
|
|
132
|
+
}}
|
|
133
|
+
renderErrorState={(props) => {
|
|
134
|
+
return <div>...</div>
|
|
135
|
+
}}
|
|
136
|
+
renderLoadingState={(props) => {
|
|
137
|
+
return <div>...</div>
|
|
138
|
+
}}
|
|
139
|
+
renderPaginationItem={(props) => {
|
|
140
|
+
return <div>...</div>
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
|
|
144
|
+
// or
|
|
145
|
+
|
|
146
|
+
<CourierInboxMenu
|
|
147
|
+
renderPopupMenuButton={(props) => {
|
|
148
|
+
return <div>...</div>
|
|
149
|
+
}}
|
|
150
|
+
renderPopupHeader={(props) => {
|
|
151
|
+
return <div>...</div>
|
|
152
|
+
}}
|
|
153
|
+
renderPopupListItem={(props) => {
|
|
154
|
+
return <div>...</div>
|
|
155
|
+
}}
|
|
156
|
+
renderPopupEmptyState={(props) => {
|
|
157
|
+
return <div>...</div>
|
|
158
|
+
}}
|
|
159
|
+
renderPopupLoadingState={(props) => {
|
|
160
|
+
return <div>...</div>
|
|
161
|
+
}}
|
|
162
|
+
renderPopupErrorState={(props) => {
|
|
163
|
+
return <div>...</div>
|
|
164
|
+
}}
|
|
165
|
+
renderPopupPaginationItem={(props) => {
|
|
166
|
+
return <div>...</div>
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
35
169
|
```
|
|
@@ -19,6 +19,8 @@ type InboxHooks = {
|
|
|
19
19
|
clickMessage: (message: InboxMessage) => Promise<void>;
|
|
20
20
|
archiveMessage: (message: InboxMessage) => Promise<void>;
|
|
21
21
|
openMessage: (message: InboxMessage) => Promise<void>;
|
|
22
|
+
unarchiveMessage: (message: InboxMessage) => Promise<void>;
|
|
23
|
+
readAllMessages: () => Promise<void>;
|
|
22
24
|
inbox?: InboxDataSet;
|
|
23
25
|
archive?: InboxDataSet;
|
|
24
26
|
unreadCount?: number;
|