17
17
*/
18
18
19
19
import React , { useState } from 'react' ;
20
- import { Info , Warning } from 'design/Icon' ;
20
+ import { Bots } from 'design/Icon' ;
21
21
import Flex from 'design/Flex' ;
22
22
23
23
import { Notification } from './Notification' ;
@@ -45,8 +45,6 @@ export const Notifications = () => {
45
45
description : loremIpsum ,
46
46
} ,
47
47
} }
48
- Icon = { Info }
49
- getColor = { theme => theme . colors . info }
50
48
onRemove = { ( ) => { } }
51
49
isAutoRemovable = { false }
52
50
/>
@@ -60,8 +58,6 @@ export const Notifications = () => {
60
58
description : loremIpsum ,
61
59
} ,
62
60
} }
63
- Icon = { Warning }
64
- getColor = { theme => theme . colors . warning }
65
61
onRemove = { ( ) => { } }
66
62
isAutoRemovable = { false }
67
63
/>
@@ -75,8 +71,33 @@ export const Notifications = () => {
75
71
description : loremIpsum ,
76
72
} ,
77
73
} }
78
- Icon = { Warning }
79
- getColor = { theme => theme . colors . error . main }
74
+ onRemove = { ( ) => { } }
75
+ isAutoRemovable = { false }
76
+ />
77
+
78
+ < Notification
79
+ item = { {
80
+ id : crypto . randomUUID ( ) ,
81
+ severity : 'neutral' ,
82
+ content : {
83
+ title : 'Neutral with title and description' ,
84
+ description : loremIpsum ,
85
+ } ,
86
+ } }
87
+ onRemove = { ( ) => { } }
88
+ isAutoRemovable = { false }
89
+ />
90
+
91
+ < Notification
92
+ item = { {
93
+ id : crypto . randomUUID ( ) ,
94
+ severity : 'neutral' ,
95
+ content : {
96
+ title : 'Custom icon with title and description' ,
97
+ description : loremIpsum ,
98
+ icon : Bots ,
99
+ } ,
100
+ } }
80
101
onRemove = { ( ) => { } }
81
102
isAutoRemovable = { false }
82
103
/>
@@ -87,10 +108,12 @@ export const Notifications = () => {
87
108
item = { {
88
109
id : crypto . randomUUID ( ) ,
89
110
severity : 'info' ,
90
- content : 'Multiline info without title. ' + loremIpsum ,
111
+ content : {
112
+ title : 'Info with title and description' ,
113
+ subtitle : 'And some subtitle, too' ,
114
+ description : loremIpsum ,
115
+ } ,
91
116
} }
92
- Icon = { Info }
93
- getColor = { theme => theme . colors . info }
94
117
onRemove = { ( ) => { } }
95
118
isAutoRemovable = { false }
96
119
/>
@@ -99,10 +122,12 @@ export const Notifications = () => {
99
122
item = { {
100
123
id : crypto . randomUUID ( ) ,
101
124
severity : 'warn' ,
102
- content : 'Multiline warning without title. ' + loremIpsum ,
125
+ content : {
126
+ title : 'Warning with title and description' ,
127
+ subtitle : 'And some subtitle, too' ,
128
+ description : loremIpsum ,
129
+ } ,
103
130
} }
104
- Icon = { Warning }
105
- getColor = { theme => theme . colors . warning }
106
131
onRemove = { ( ) => { } }
107
132
isAutoRemovable = { false }
108
133
/>
@@ -111,10 +136,12 @@ export const Notifications = () => {
111
136
item = { {
112
137
id : crypto . randomUUID ( ) ,
113
138
severity : 'error' ,
114
- content : 'Multiline error without title. ' + loremIpsum ,
139
+ content : {
140
+ title : 'Error with title and description' ,
141
+ subtitle : 'And some subtitle, too' ,
142
+ description : loremIpsum ,
143
+ } ,
115
144
} }
116
- Icon = { Warning }
117
- getColor = { theme => theme . colors . error . main }
118
145
onRemove = { ( ) => { } }
119
146
isAutoRemovable = { false }
120
147
/>
@@ -125,10 +152,8 @@ export const Notifications = () => {
125
152
item = { {
126
153
id : crypto . randomUUID ( ) ,
127
154
severity : 'info' ,
128
- content : 'Info without title' ,
155
+ content : 'Multiline info without title. ' + loremIpsum ,
129
156
} }
130
- Icon = { Info }
131
- getColor = { theme => theme . colors . info }
132
157
onRemove = { ( ) => { } }
133
158
isAutoRemovable = { false }
134
159
/>
@@ -137,10 +162,8 @@ export const Notifications = () => {
137
162
item = { {
138
163
id : crypto . randomUUID ( ) ,
139
164
severity : 'warn' ,
140
- content : 'Warning without title' ,
165
+ content : 'Multiline warning without title. ' + loremIpsum ,
141
166
} }
142
- Icon = { Warning }
143
- getColor = { theme => theme . colors . warning }
144
167
onRemove = { ( ) => { } }
145
168
isAutoRemovable = { false }
146
169
/>
@@ -149,10 +172,8 @@ export const Notifications = () => {
149
172
item = { {
150
173
id : crypto . randomUUID ( ) ,
151
174
severity : 'error' ,
152
- content : 'Error without title' ,
175
+ content : 'Multiline error without title. ' + loremIpsum ,
153
176
} }
154
- Icon = { Warning }
155
- getColor = { theme => theme . colors . error . main }
156
177
onRemove = { ( ) => { } }
157
178
isAutoRemovable = { false }
158
179
/>
@@ -163,53 +184,27 @@ export const Notifications = () => {
163
184
item = { {
164
185
id : crypto . randomUUID ( ) ,
165
186
severity : 'info' ,
166
- content : {
167
- title : 'Info with link' ,
168
- description : loremIpsum ,
169
- link : {
170
- href : 'https://goteleport.com' ,
171
- text : 'goteleport.com' ,
172
- } ,
173
- } ,
174
- } }
175
- Icon = { Info }
176
- getColor = { theme => theme . colors . info }
177
- onRemove = { ( ) => { } }
178
- isAutoRemovable = { false }
179
- />
180
- < Notification
181
- item = { {
182
- id : crypto . randomUUID ( ) ,
183
- severity : 'warn' ,
184
- content : {
185
- title : 'Warning with link' ,
186
- description : loremIpsum ,
187
- link : {
188
- href : 'https://goteleport.com' ,
189
- text : 'goteleport.com' ,
190
- } ,
191
- } ,
187
+ content : 'Info without title' ,
192
188
} }
193
- Icon = { Warning }
194
- getColor = { theme => theme . colors . warning }
195
189
onRemove = { ( ) => { } }
196
190
isAutoRemovable = { false }
197
191
/>
192
+ </ Flex >
193
+
194
+ < Flex flexDirection = "column" gap = { 4 } >
198
195
< Notification
199
196
item = { {
200
197
id : crypto . randomUUID ( ) ,
201
- severity : 'error ' ,
198
+ severity : 'info ' ,
202
199
content : {
203
- title : 'Error with link' ,
200
+ title : 'Info with link' ,
204
201
description : loremIpsum ,
205
- link : {
202
+ action : {
206
203
href : 'https://goteleport.com' ,
207
- text : 'goteleport.com ' ,
204
+ content : 'Learn More ' ,
208
205
} ,
209
206
} ,
210
207
} }
211
- Icon = { Warning }
212
- getColor = { theme => theme . colors . error . main }
213
208
onRemove = { ( ) => { } }
214
209
isAutoRemovable = { false }
215
210
/>
@@ -225,67 +220,61 @@ export const Notifications = () => {
225
220
list : [ loremIpsum , loremIpsum ] ,
226
221
} ,
227
222
} }
228
- Icon = { Info }
229
- getColor = { theme => theme . colors . info }
230
223
onRemove = { ( ) => { } }
231
224
isAutoRemovable = { false }
232
225
/>
226
+ </ Flex >
227
+
228
+ < Flex flexDirection = "column" gap = { 4 } >
233
229
< Notification
234
230
item = { {
235
231
id : crypto . randomUUID ( ) ,
236
- severity : 'warn' ,
237
- content : {
238
- title : 'Warning with list' ,
239
- list : [ loremIpsum , loremIpsum ] ,
240
- } ,
232
+ severity : 'info' ,
233
+ content :
234
+ 'Long continuous strings. /Users/test/Library/ApplicationSupport/foobarbazio/barbazfoobarioloremoipsumoconfigurationobaziofoobazi/baz/lorem/ipsum/Electron/configuration.json' ,
241
235
} }
242
- Icon = { Warning }
243
- getColor = { theme => theme . colors . warning . main }
244
236
onRemove = { ( ) => { } }
245
237
isAutoRemovable = { false }
246
238
/>
239
+ </ Flex >
240
+ < Flex flexDirection = "column" gap = { 4 } >
247
241
< Notification
248
242
item = { {
249
243
id : crypto . randomUUID ( ) ,
250
- severity : 'error ' ,
244
+ severity : 'info ' ,
251
245
content : {
252
- title : 'Error with list' ,
253
- list : [ loremIpsum , loremIpsum ] ,
246
+ title :
247
+ 'A very long title with a very long address that spans multiple lines tcp-postgres.foo.bar.baz.cloud.gravitational.io and some more text on another line' ,
248
+ description :
249
+ 'Long continuous strings. /Users/test/Library/ApplicationSupport/foobarbazio/barbazfoobarioloremoipsumoconfigurationobaziofoobazi/baz/lorem/ipsum/Electron/configuration.json' ,
254
250
} ,
255
251
} }
256
- Icon = { Warning }
257
- getColor = { theme => theme . colors . error . main }
258
252
onRemove = { ( ) => { } }
259
253
isAutoRemovable = { false }
260
254
/>
261
255
</ Flex >
262
-
263
256
< Flex flexDirection = "column" gap = { 4 } >
264
257
< Notification
265
258
item = { {
266
259
id : crypto . randomUUID ( ) ,
267
260
severity : 'info' ,
268
- content :
269
- 'Long continuous strings. /Users/test/Library/ApplicationSupport/foobarbazio/barbazfoobarioloremoipsumoconfigurationobaziofoobazi/baz/lorem/ipsum/Electron/configuration.json' ,
261
+ content : {
262
+ description : 'Info with description, without a title' ,
263
+ } ,
270
264
} }
271
- Icon = { Info }
272
- getColor = { theme => theme . colors . info }
273
265
onRemove = { ( ) => { } }
274
266
isAutoRemovable = { false }
275
267
/>
268
+ </ Flex >
269
+ < Flex flexDirection = "column" gap = { 4 } >
276
270
< Notification
277
271
item = { {
278
272
id : crypto . randomUUID ( ) ,
279
273
severity : 'info' ,
280
274
content : {
281
- title :
282
- 'A very long title with a very long address that spans multiple lines tcp-postgres.foo.bar.baz.cloud.gravitational.io and some more text on another line' ,
283
- description :
284
- 'Long continuous strings. /Users/test/Library/ApplicationSupport/foobarbazio/barbazfoobarioloremoipsumoconfigurationobaziofoobazi/baz/lorem/ipsum/Electron/configuration.json' ,
275
+ list : [ 'Info with a list' , 'But no title' ] ,
285
276
} ,
286
277
} }
287
- Icon = { Info }
288
- getColor = { theme => theme . colors . info }
289
278
onRemove = { ( ) => { } }
290
279
isAutoRemovable = { false }
291
280
/>
@@ -310,10 +299,7 @@ export const AutoRemovable = () => {
310
299
"This will be automatically removed after 5 seconds. Click to expand it. Mouseover it to restart the timer. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s." ,
311
300
} }
312
301
onRemove = { ( ) => setShowInfo ( false ) }
313
- Icon = { Info }
314
- getColor = { theme => theme . colors . info }
315
302
isAutoRemovable = { true }
316
- autoRemoveDurationMs = { 5000 }
317
303
/>
318
304
) : (
319
305
< div > Info notification has been removed</ div >
@@ -327,10 +313,7 @@ export const AutoRemovable = () => {
327
313
"This will be automatically removed after 5 seconds. Click to expand it. Mouseover it to restart the timer. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s." ,
328
314
} }
329
315
onRemove = { ( ) => setShowWarning ( false ) }
330
- Icon = { Warning }
331
- getColor = { theme => theme . colors . warning }
332
316
isAutoRemovable = { true }
333
- autoRemoveDurationMs = { 5000 }
334
317
/>
335
318
) : (
336
319
< div > Warning notification has been removed</ div >
@@ -344,8 +327,6 @@ export const AutoRemovable = () => {
344
327
"This can only be removed by clicking on the X. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s." ,
345
328
} }
346
329
onRemove = { ( ) => setShowError ( false ) }
347
- Icon = { Warning }
348
- getColor = { theme => theme . colors . error . main }
349
330
isAutoRemovable = { false }
350
331
/>
351
332
) : (
0 commit comments