Debian Codegraph @

node/@patternfly/react-core/src/components/Label/examples/LabelFilled.tsx

raw
1 import { Fragment } from 'react';
2 import { Label, LabelColor, LabelStatus } from '@patternfly/react-core';
3 import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
4
5 export const LabelFilled: React.FunctionComponent = () => {
6 const logColor = (color: string) => {
7 // eslint-disable-next-line no-console
8 console.log(color, 'label clicked');
9 };
10 return (
11 <Fragment>
12 <strong>Non-status:</strong>
13 <br />
14 <br />
15 <Label>Grey</Label>
16 <Label icon={<CubeIcon />}>Grey icon</Label>
17 <Label onClose={() => Function.prototype}>Grey removable</Label>
18 <Label icon={<CubeIcon />} onClose={() => Function.prototype}>
19 Grey icon removable
20 </Label>
21 <Label href="#filled">Grey link</Label>
22 <Label href="#filled" onClose={() => Function.prototype}>
23 Grey link removable
24 </Label>{' '}
25 <Label onClick={() => logColor('grey')}>Grey clickable</Label>{' '}
26 <Label onClick={() => logColor('grey')} onClose={() => Function.prototype}>
27 Grey clickable removable
28 </Label>{' '}
29 <Label icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
30 Grey label with icon that overflows
31 </Label>{' '}
32 <Label isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
33 Grey link removable (disabled)
34 </Label>{' '}
35 <Label isDisabled icon={<CubeIcon />} onClick={() => logColor('grey')} onClose={() => Function.prototype}>
36 Grey clickable removable (disabled)
37 </Label>
38 <br />
39 <br />
40 <Label color={LabelColor.blue}>Blue</Label>
41 <Label color={LabelColor.blue} icon={<CubeIcon />}>
42 Blue icon
43 </Label>
44 <Label color={LabelColor.blue} onClose={() => Function.prototype}>
45 Blue removable
46 </Label>
47 <Label color={LabelColor.blue} icon={<CubeIcon />} onClose={() => Function.prototype}>
48 Blue icon removable
49 </Label>
50 <Label color={LabelColor.blue} href="#filled">
51 Blue link
52 </Label>
53 <Label color={LabelColor.blue} href="#filled" onClose={() => Function.prototype}>
54 Blue link removable
55 </Label>{' '}
56 <Label color={LabelColor.blue} onClick={() => logColor('blue')}>
57 Blue clickable
58 </Label>
59 <Label color={LabelColor.blue} onClick={() => logColor('blue')} onClose={() => Function.prototype}>
60 Blue clickable removable
61 </Label>{' '}
62 <Label color={LabelColor.blue} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
63 Blue label with icon that overflows
64 </Label>{' '}
65 <Label color={LabelColor.blue} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
66 Blue link removable (disabled)
67 </Label>{' '}
68 <Label
69 color={LabelColor.blue}
70 isDisabled
71 icon={<CubeIcon />}
72 onClick={() => logColor('blue')}
73 onClose={() => Function.prototype}
74 >
75 Blue clickable removable (disabled)
76 </Label>
77 <br />
78 <br />
79 <Label color={LabelColor.green}>Green</Label>
80 <Label color={LabelColor.green} icon={<CubeIcon />}>
81 Green icon
82 </Label>
83 <Label color={LabelColor.green} onClose={() => Function.prototype}>
84 Green removable
85 </Label>
86 <Label color={LabelColor.green} icon={<CubeIcon />} onClose={() => Function.prototype}>
87 Green icon removable
88 </Label>
89 <Label color={LabelColor.green} href="#filled">
90 Green link
91 </Label>
92 <Label color={LabelColor.green} href="#filled" onClose={() => Function.prototype}>
93 Green link removable
94 </Label>{' '}
95 <Label color={LabelColor.green} onClick={() => logColor('green')}>
96 Green clickable
97 </Label>
98 <Label color={LabelColor.green} onClick={() => logColor('green')} onClose={() => Function.prototype}>
99 Green clickable removable
100 </Label>{' '}
101 <Label color={LabelColor.green} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
102 Green label with icon that overflows
103 </Label>{' '}
104 <Label color={LabelColor.green} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
105 Green link removable (disabled)
106 </Label>{' '}
107 <Label
108 color={LabelColor.green}
109 isDisabled
110 icon={<CubeIcon />}
111 onClick={() => logColor('green')}
112 onClose={() => Function.prototype}
113 >
114 Green clickable removable (disabled)
115 </Label>
116 <br />
117 <br />
118 <Label color={LabelColor.orange}>Orange</Label>
119 <Label color={LabelColor.orange} icon={<CubeIcon />}>
120 Orange icon
121 </Label>
122 <Label color={LabelColor.orange} onClose={() => Function.prototype}>
123 Orange removable
124 </Label>
125 <Label color={LabelColor.orange} icon={<CubeIcon />} onClose={() => Function.prototype}>
126 Orange icon removable
127 </Label>
128 <Label color={LabelColor.orange} href="#filled">
129 Orange link
130 </Label>
131 <Label color={LabelColor.orange} href="#filled" onClose={() => Function.prototype}>
132 Orange link removable
133 </Label>{' '}
134 <Label color={LabelColor.orange} onClick={() => logColor('orange')}>
135 Orange clickable
136 </Label>
137 <Label color={LabelColor.orange} onClick={() => logColor('orange')} onClose={() => Function.prototype}>
138 Orange clickable removable
139 </Label>{' '}
140 <Label color={LabelColor.orange} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
141 Orange label with icon that overflows
142 </Label>{' '}
143 <Label color={LabelColor.orange} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
144 Orange link removable (disabled)
145 </Label>{' '}
146 <Label
147 color={LabelColor.orange}
148 isDisabled
149 icon={<CubeIcon />}
150 onClick={() => logColor('orange')}
151 onClose={() => Function.prototype}
152 >
153 Orange clickable removable (disabled)
154 </Label>
155 <br />
156 <br />
157 <Label color={LabelColor.red}>Red</Label>
158 <Label color={LabelColor.red} icon={<CubeIcon />}>
159 Red icon
160 </Label>
161 <Label color={LabelColor.red} onClose={() => Function.prototype}>
162 Red removable
163 </Label>
164 <Label color={LabelColor.red} icon={<CubeIcon />} onClose={() => Function.prototype}>
165 Red icon removable
166 </Label>
167 <Label color={LabelColor.red} href="#filled">
168 Red link
169 </Label>
170 <Label color={LabelColor.red} href="#filled" onClose={() => Function.prototype}>
171 Red link removable
172 </Label>{' '}
173 <Label color={LabelColor.red} onClick={() => logColor('red')}>
174 Red clickable
175 </Label>
176 <Label color={LabelColor.red} onClick={() => logColor('red')} onClose={() => Function.prototype}>
177 Red clickable removable
178 </Label>{' '}
179 <Label color={LabelColor.red} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
180 Red label with icon that overflows
181 </Label>{' '}
182 <Label color={LabelColor.red} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
183 Red link removable (disabled)
184 </Label>{' '}
185 <Label
186 color={LabelColor.red}
187 isDisabled
188 icon={<CubeIcon />}
189 onClick={() => logColor('red')}
190 onClose={() => Function.prototype}
191 >
192 Red clickable removable (disabled)
193 </Label>
194 <br />
195 <br />
196 <Label color={LabelColor.orangered}>Orange red</Label>
197 <Label color={LabelColor.orangered} icon={<CubeIcon />}>
198 Orange red icon
199 </Label>
200 <Label color={LabelColor.orangered} onClose={() => Function.prototype}>
201 Orange red removable
202 </Label>
203 <Label color={LabelColor.orangered} icon={<CubeIcon />} onClose={() => Function.prototype}>
204 Orange red icon removable
205 </Label>
206 <Label color={LabelColor.orangered} href="#filled">
207 Orange red link
208 </Label>
209 <Label color={LabelColor.orangered} href="#filled" onClose={() => Function.prototype}>
210 Orange red link removable
211 </Label>
212 <Label color={LabelColor.orangered} onClick={() => logColor('orangered')}>
213 Orange red clickable
214 </Label>
215 <Label color={LabelColor.orangered} onClick={() => logColor('orangered')} onClose={() => Function.prototype}>
216 Orange red clickable removable
217 </Label>
218 <Label color={LabelColor.orangered} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
219 Orange red label with icon that overflows
220 </Label>
221 <br />
222 <br />
223 <Label color={LabelColor.purple}>Purple</Label>
224 <Label color={LabelColor.purple} icon={<CubeIcon />}>
225 Purple icon
226 </Label>
227 <Label color={LabelColor.purple} onClose={() => Function.prototype}>
228 Purple removable
229 </Label>
230 <Label color={LabelColor.purple} icon={<CubeIcon />} onClose={() => Function.prototype}>
231 Purple icon removable
232 </Label>
233 <Label color={LabelColor.purple} href="#filled">
234 Purple link
235 </Label>
236 <Label color={LabelColor.purple} href="#filled" onClose={() => Function.prototype}>
237 Purple link removable
238 </Label>{' '}
239 <Label color={LabelColor.purple} onClick={() => logColor('purple')}>
240 Purple clickable
241 </Label>
242 <Label color={LabelColor.purple} onClick={() => logColor('purple')} onClose={() => Function.prototype}>
243 Purple clickable removable
244 </Label>{' '}
245 <Label color={LabelColor.purple} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
246 Purple label with icon that overflows
247 </Label>{' '}
248 <Label color={LabelColor.purple} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
249 Purple link removable (disabled)
250 </Label>{' '}
251 <Label
252 color={LabelColor.purple}
253 isDisabled
254 icon={<CubeIcon />}
255 onClick={() => logColor('purple')}
256 onClose={() => Function.prototype}
257 >
258 Purple clickable removable (disabled)
259 </Label>
260 <br />
261 <br />
262 <Label color={LabelColor.teal}>Teal</Label>
263 <Label color={LabelColor.teal} icon={<CubeIcon />}>
264 Teal icon
265 </Label>
266 <Label color={LabelColor.teal} onClose={() => Function.prototype}>
267 Teal removable
268 </Label>
269 <Label color={LabelColor.teal} icon={<CubeIcon />} onClose={() => Function.prototype}>
270 Teal icon removable
271 </Label>
272 <Label color={LabelColor.teal} href="#filled">
273 Teal link
274 </Label>
275 <Label color={LabelColor.teal} href="#filled" onClose={() => Function.prototype}>
276 Teal link removable
277 </Label>{' '}
278 <Label color={LabelColor.teal} onClick={() => logColor('teal')}>
279 Teal clickable
280 </Label>
281 <Label color={LabelColor.teal} onClick={() => logColor('teal')} onClose={() => Function.prototype}>
282 Teal clickable removable
283 </Label>{' '}
284 <Label color={LabelColor.teal} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
285 Teal label with icon that overflows
286 </Label>{' '}
287 <Label color={LabelColor.teal} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
288 Teal link removable (disabled)
289 </Label>{' '}
290 <Label
291 color={LabelColor.teal}
292 isDisabled
293 icon={<CubeIcon />}
294 onClick={() => logColor('teal')}
295 onClose={() => Function.prototype}
296 >
297 Teal clickable removable (disabled)
298 </Label>
299 <br />
300 <br />
301 <Label color={LabelColor.yellow}>Yellow</Label>
302 <Label color={LabelColor.yellow} icon={<CubeIcon />}>
303 Yellow icon
304 </Label>
305 <Label color={LabelColor.yellow} onClose={() => Function.prototype}>
306 Yellow removable
307 </Label>
308 <Label color={LabelColor.yellow} icon={<CubeIcon />} onClose={() => Function.prototype}>
309 Yellow icon removable
310 </Label>
311 <Label color={LabelColor.yellow} href="#filled">
312 Yellow link
313 </Label>
314 <Label color={LabelColor.yellow} href="#filled" onClose={() => Function.prototype}>
315 Yellow link removable
316 </Label>{' '}
317 <Label color={LabelColor.yellow} onClick={() => logColor('yellow')}>
318 Yellow clickable
319 </Label>
320 <Label color={LabelColor.yellow} onClick={() => logColor('yellow')} onClose={() => Function.prototype}>
321 Yellow clickable removable
322 </Label>{' '}
323 <Label color={LabelColor.yellow} icon={<CubeIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
324 Yellow label with icon that overflows
325 </Label>{' '}
326 <Label color={LabelColor.yellow} isDisabled icon={<CubeIcon />} href="#filled" onClose={() => Function.prototype}>
327 Yellow link removable (disabled)
328 </Label>{' '}
329 <Label
330 color={LabelColor.yellow}
331 isDisabled
332 icon={<CubeIcon />}
333 onClick={() => logColor('yellow')}
334 onClose={() => Function.prototype}
335 >
336 Yellow clickable removable (disabled)
337 </Label>
338 <br />
339 <br />
340 <div style={{ width: '250px' }}>
341 <Label>Label that overflows its parent, but has no textMaxWidth on its own</Label>
342 </div>
343 <br />
344 <strong>Status:</strong>
345 <br />
346 <br />
347 <Label status={LabelStatus.success}>Success</Label>
348 <Label status={LabelStatus.success} onClose={() => Function.prototype}>
349 Success removable
350 </Label>
351 <Label status={LabelStatus.success} href="#filled">
352 Success link
353 </Label>
354 <Label status={LabelStatus.success} href="#filled" onClose={() => Function.prototype}>
355 Success link removable
356 </Label>
357 <Label status={LabelStatus.success} onClick={() => logColor('success')}>
358 Success clickable
359 </Label>
360 <Label status={LabelStatus.success} onClick={() => logColor('success')} onClose={() => Function.prototype}>
361 Success clickable removable
362 </Label>
363 <Label status={LabelStatus.success} onClose={() => Function.prototype} textMaxWidth="16ch">
364 Success label with text that overflows
365 </Label>
366 <br />
367 <br />
368 <Label status={LabelStatus.warning}>Warning</Label>
369 <Label status={LabelStatus.warning} onClose={() => Function.prototype}>
370 Warning removable
371 </Label>
372 <Label status={LabelStatus.warning} href="#filled">
373 Warning link
374 </Label>
375 <Label status={LabelStatus.warning} href="#filled" onClose={() => Function.prototype}>
376 Warning link removable
377 </Label>
378 <Label status={LabelStatus.warning} onClick={() => logColor('warning')}>
379 Warning clickable
380 </Label>
381 <Label status={LabelStatus.warning} onClick={() => logColor('warning')} onClose={() => Function.prototype}>
382 Warning clickable removable
383 </Label>
384 <Label status={LabelStatus.warning} onClose={() => Function.prototype} textMaxWidth="16ch">
385 Warning label with text that overflows
386 </Label>
387 <br />
388 <br />
389 <Label status={LabelStatus.danger}>Danger</Label>
390 <Label status={LabelStatus.danger} onClose={() => Function.prototype}>
391 Danger removable
392 </Label>
393 <Label status={LabelStatus.danger} href="#filled">
394 Danger link
395 </Label>
396 <Label status={LabelStatus.danger} href="#filled" onClose={() => Function.prototype}>
397 Danger link removable
398 </Label>
399 <Label status={LabelStatus.danger} onClick={() => logColor('danger')}>
400 Danger clickable
401 </Label>
402 <Label status={LabelStatus.danger} onClick={() => logColor('danger')} onClose={() => Function.prototype}>
403 Danger clickable removable
404 </Label>
405 <Label status={LabelStatus.danger} onClose={() => Function.prototype} textMaxWidth="16ch">
406 Danger label with text that overflows
407 </Label>
408 <br />
409 <br />
410 <Label status={LabelStatus.info}>Info</Label>
411 <Label status={LabelStatus.info} onClose={() => Function.prototype}>
412 Info removable
413 </Label>
414 <Label status={LabelStatus.info} href="#filled">
415 Info link
416 </Label>
417 <Label status={LabelStatus.info} href="#filled" onClose={() => Function.prototype}>
418 Info link removable
419 </Label>
420 <Label status={LabelStatus.info} onClick={() => logColor('info')}>
421 Info clickable
422 </Label>
423 <Label status={LabelStatus.info} onClick={() => logColor('info')} onClose={() => Function.prototype}>
424 Info clickable removable
425 </Label>
426 <Label status={LabelStatus.info} onClose={() => Function.prototype} textMaxWidth="16ch">
427 Info label with text that overflows
428 </Label>
429 <br />
430 <br />
431 <Label status={LabelStatus.custom}>Custom</Label>
432 <Label status={LabelStatus.custom} onClose={() => Function.prototype}>
433 Custom removable
434 </Label>
435 <Label status={LabelStatus.custom} href="#filled">
436 Custom link
437 </Label>
438 <Label status={LabelStatus.custom} href="#filled" onClose={() => Function.prototype}>
439 Custom link removable
440 </Label>
441 <Label status={LabelStatus.custom} onClick={() => logColor('custom')}>
442 Custom clickable
443 </Label>
444 <Label status={LabelStatus.custom} onClick={() => logColor('custom')} onClose={() => Function.prototype}>
445 Custom clickable removable
446 </Label>
447 <Label status={LabelStatus.custom} onClose={() => Function.prototype} textMaxWidth="16ch">
448 Custom label with text that overflows
449 </Label>
450 </Fragment>
451 );
452 };