@nextelco/common-ui 1.5.69 → 1.5.72
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/dist/bundle.js +1 -1
- package/dist/types/components/atoms/Button/Button.stories.d.ts +425 -41
- package/dist/types/components/atoms/Select/Select.stories.d.ts +1 -10
- package/dist/types/components/atoms/Stack/Stack.d.ts +1 -1
- package/dist/types/components/atoms/Stack/Stack.stories.d.ts +1 -11
- package/dist/types/components/layout/Header/Header.d.ts +2 -3
- package/dist/types/components/layout/Header/Header.stories.d.ts +40 -6
- package/dist/types/components/organisms/LazyLoading/LazyLoading.d.ts +75 -13
- package/dist/types/components/organisms/Profile/Profile.stories.d.ts +5 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/ButtonTheme.d.ts +2 -2
- package/package.json +2 -2
- package/dist/types/components/moleculas/Operators/Operators.d.ts +0 -15
- package/dist/types/components/moleculas/Operators/Operators.stories.d.ts +0 -8
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Meta
|
1
|
+
import { Meta } from '@storybook/react';
|
2
2
|
import { ComponentProps } from 'react';
|
3
3
|
import Button from './Button';
|
4
4
|
type StoryProps = ComponentProps<typeof Button> & {
|
@@ -6,43 +6,427 @@ type StoryProps = ComponentProps<typeof Button> & {
|
|
6
6
|
};
|
7
7
|
declare const meta: Meta<StoryProps>;
|
8
8
|
export default meta;
|
9
|
-
|
10
|
-
|
11
|
-
export
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
export
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
export
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
export
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
9
|
+
/**
|
10
|
+
|
11
|
+
export const Ir_frente: Story = {
|
12
|
+
args: {
|
13
|
+
variant: 'cui-navigate',
|
14
|
+
size: 'cui-circ-sm',
|
15
|
+
iconPrev: faChevronUp,
|
16
|
+
},
|
17
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
18
|
+
}
|
19
|
+
|
20
|
+
export const Ir_tras: Story = {
|
21
|
+
args: {
|
22
|
+
variant: 'cui-navigate',
|
23
|
+
size: 'cui-circ-sm',
|
24
|
+
iconPrev: faChevronDown,
|
25
|
+
},
|
26
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
27
|
+
}
|
28
|
+
|
29
|
+
export const Adicionar: Story = {
|
30
|
+
args: {
|
31
|
+
variant: 'cui-actions',
|
32
|
+
mode: 'cui-add',
|
33
|
+
size: 'cui-md',
|
34
|
+
buttonText: 'Adicionar',
|
35
|
+
iconPrev: faCirclePlus,
|
36
|
+
},
|
37
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
38
|
+
}
|
39
|
+
|
40
|
+
export const Adicionar_config: Story = {
|
41
|
+
args: {
|
42
|
+
variant: 'cui-actions',
|
43
|
+
mode: 'cui-base_actions',
|
44
|
+
size: 'cui-md_lg',
|
45
|
+
buttonText: 'Adicionar Config',
|
46
|
+
iconPrev: faScrewdriverWrench,
|
47
|
+
},
|
48
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
49
|
+
}
|
50
|
+
|
51
|
+
export const Marcar_default: Story = {
|
52
|
+
args: {
|
53
|
+
variant: 'cui-actions',
|
54
|
+
mode: 'cui-base_actions_gray',
|
55
|
+
size: 'cui-md',
|
56
|
+
buttonText: 'Marcar default',
|
57
|
+
},
|
58
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
59
|
+
}
|
60
|
+
|
61
|
+
export const Valid_config: Story = {
|
62
|
+
args: {
|
63
|
+
variant: 'cui-actions',
|
64
|
+
mode: 'cui-filters_btn',
|
65
|
+
size: 'cui-md_lg',
|
66
|
+
buttonText: 'Valores de Fibras Ativas Reservas e Mortas',
|
67
|
+
},
|
68
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
69
|
+
}
|
70
|
+
|
71
|
+
export const Criar_regra: Story = {
|
72
|
+
args: {
|
73
|
+
variant: 'cui-actions',
|
74
|
+
mode: 'cui-create',
|
75
|
+
size: 'cui-ext_long',
|
76
|
+
buttonText: 'Criar Regra',
|
77
|
+
iconPrev: faListCheck,
|
78
|
+
},
|
79
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
80
|
+
}
|
81
|
+
|
82
|
+
export const Transf_proj_dev: Story = {
|
83
|
+
args: {
|
84
|
+
variant: 'cui-actions',
|
85
|
+
mode: 'cui-create',
|
86
|
+
size: 'cui-ext_long',
|
87
|
+
buttonText: 'Transferir projeto de dev',
|
88
|
+
iconPrev: faDownload,
|
89
|
+
},
|
90
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
91
|
+
}
|
92
|
+
|
93
|
+
export const Clonar: Story = {
|
94
|
+
args: {
|
95
|
+
variant: 'cui-actions',
|
96
|
+
mode: 'cui-create',
|
97
|
+
size: 'cui-ext_long',
|
98
|
+
buttonText: 'Clonar',
|
99
|
+
iconPrev: faClone,
|
100
|
+
},
|
101
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
102
|
+
}
|
103
|
+
|
104
|
+
export const Eliminar_clone: Story = {
|
105
|
+
args: {
|
106
|
+
variant: 'cui-actions',
|
107
|
+
mode: 'cui-delete',
|
108
|
+
size: 'cui-ext_long',
|
109
|
+
buttonText: 'Eliminar',
|
110
|
+
iconPrev: faTrash,
|
111
|
+
},
|
112
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
113
|
+
}
|
114
|
+
|
115
|
+
export const Adicionar_logo: Story = {
|
116
|
+
args: {
|
117
|
+
variant: 'cui-actions',
|
118
|
+
mode: 'cui-add_logo',
|
119
|
+
size: 'cui-md_form',
|
120
|
+
buttonText: 'Adicionar Logótipo',
|
121
|
+
iconPrev: faCirclePlus,
|
122
|
+
},
|
123
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
124
|
+
}
|
125
|
+
|
126
|
+
export const Adicionar_parceiro: Story = {
|
127
|
+
args: {
|
128
|
+
variant: 'cui-actions',
|
129
|
+
mode: 'cui-add_partner',
|
130
|
+
size: 'cui-md',
|
131
|
+
buttonText: 'Adicionar parceiro',
|
132
|
+
iconPrev: faCirclePlus,
|
133
|
+
},
|
134
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
135
|
+
}
|
136
|
+
|
137
|
+
export const Eliminar: Story = {
|
138
|
+
args: {
|
139
|
+
variant: 'cui-actions',
|
140
|
+
mode: 'cui-delete',
|
141
|
+
size: 'cui-md',
|
142
|
+
buttonText: 'Eliminar',
|
143
|
+
iconPrev: faTrash,
|
144
|
+
},
|
145
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
146
|
+
}
|
147
|
+
|
148
|
+
export const Transferir_fich: Story = {
|
149
|
+
args: {
|
150
|
+
variant: 'cui-actions',
|
151
|
+
mode: 'cui-download_file',
|
152
|
+
size: 'cui-md',
|
153
|
+
buttonText: 'Transferir Ficheiro',
|
154
|
+
iconPrev: faDownload,
|
155
|
+
},
|
156
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
157
|
+
}
|
158
|
+
|
159
|
+
export const Exec_validador: Story = {
|
160
|
+
args: {
|
161
|
+
variant: 'cui-actions',
|
162
|
+
mode: 'cui-exec_validator',
|
163
|
+
size: 'cui-md',
|
164
|
+
buttonText: 'Executar Validador',
|
165
|
+
iconPrev: faCircleCheck,
|
166
|
+
},
|
167
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
168
|
+
}
|
169
|
+
|
170
|
+
export const Sucesso_proj_val: Story = {
|
171
|
+
args: {
|
172
|
+
variant: 'cui-actions',
|
173
|
+
mode: 'cui-project_valid',
|
174
|
+
size: 'cui-md',
|
175
|
+
buttonText: 'Sucesso: Projeto Válido',
|
176
|
+
iconPrev: faCircleCheck,
|
177
|
+
},
|
178
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
179
|
+
}
|
180
|
+
|
181
|
+
export const Erro_proj_inval: Story = {
|
182
|
+
args: {
|
183
|
+
variant: 'cui-actions',
|
184
|
+
mode: 'cui-project_invalid',
|
185
|
+
size: 'cui-md',
|
186
|
+
buttonText: 'Erro: Projeto Inválido',
|
187
|
+
iconPrev: faCircleXmark,
|
188
|
+
},
|
189
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
190
|
+
}
|
191
|
+
|
192
|
+
export const Gerar_BoM: Story = {
|
193
|
+
args: {
|
194
|
+
variant: 'cui-actions',
|
195
|
+
mode: 'cui-generate_BoM_sin',
|
196
|
+
size: 'cui-md',
|
197
|
+
buttonText: 'Gerar BoM',
|
198
|
+
iconPrev: faCube,
|
199
|
+
},
|
200
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
201
|
+
}
|
202
|
+
|
203
|
+
export const Re_Gerar_Pre_BoM: Story = {
|
204
|
+
args: {
|
205
|
+
variant: 'cui-actions',
|
206
|
+
mode: 'cui-generate_BoM_sin',
|
207
|
+
size: 'cui-md',
|
208
|
+
buttonText: 'Re-gerar Pré-BoM',
|
209
|
+
iconPrev: faCube,
|
210
|
+
},
|
211
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
212
|
+
}
|
213
|
+
|
214
|
+
export const Gerar_Pre_sinoticos: Story = {
|
215
|
+
args: {
|
216
|
+
variant: 'cui-actions',
|
217
|
+
mode: 'cui-generate_BoM_sin',
|
218
|
+
size: 'cui-md',
|
219
|
+
buttonText: 'Gerar Pré-BoM',
|
220
|
+
iconPrev: faCubes,
|
221
|
+
},
|
222
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
223
|
+
}
|
224
|
+
|
225
|
+
export const Gerar_Aloc_Juntas: Story = {
|
226
|
+
args: {
|
227
|
+
variant: 'cui-actions',
|
228
|
+
mode: 'cui-generate_BoM_sin',
|
229
|
+
size: 'cui-md',
|
230
|
+
buttonText: 'Gerar Alocação Juntas',
|
231
|
+
iconPrev: faConfluence,
|
232
|
+
},
|
233
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
234
|
+
}
|
235
|
+
|
236
|
+
export const Gravar: Story = {
|
237
|
+
args: {
|
238
|
+
variant: 'cui-actions',
|
239
|
+
mode: 'cui-save',
|
240
|
+
size: 'cui-sm',
|
241
|
+
buttonText: 'Gravar',
|
242
|
+
},
|
243
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
244
|
+
}
|
245
|
+
|
246
|
+
export const Cancelar: Story = {
|
247
|
+
args: {
|
248
|
+
variant: 'cui-actions',
|
249
|
+
mode: 'cui-cancel',
|
250
|
+
size: 'cui-sm',
|
251
|
+
buttonText: 'Cancelar',
|
252
|
+
},
|
253
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
254
|
+
}
|
255
|
+
|
256
|
+
export const Historico_tarefas: Story = {
|
257
|
+
args: {
|
258
|
+
variant: 'cui-actions',
|
259
|
+
mode: 'cui-history_options',
|
260
|
+
size: 'cui-sm',
|
261
|
+
buttonText: 'Tarefas',
|
262
|
+
iconPrev: faListCheck,
|
263
|
+
},
|
264
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
265
|
+
}
|
266
|
+
|
267
|
+
export const Historico_erros: Story = {
|
268
|
+
args: {
|
269
|
+
variant: 'cui-actions',
|
270
|
+
mode: 'cui-history_options',
|
271
|
+
size: 'cui-sm',
|
272
|
+
buttonText: 'Erros',
|
273
|
+
iconPrev: faCircleXmark,
|
274
|
+
},
|
275
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
276
|
+
}
|
277
|
+
|
278
|
+
export const Transferir_fich_excel: Story = {
|
279
|
+
args: {
|
280
|
+
variant: 'cui-actions',
|
281
|
+
mode: 'cui-download_excel',
|
282
|
+
size: 'cui-md',
|
283
|
+
buttonText: 'Transferir Ficheiro Excel',
|
284
|
+
iconPrev: faTableCells,
|
285
|
+
},
|
286
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
287
|
+
}
|
288
|
+
|
289
|
+
export const Eliminar_fich: Story = {
|
290
|
+
args: {
|
291
|
+
variant: 'cui-actions',
|
292
|
+
mode: 'cui-delete_file',
|
293
|
+
size: 'cui-md',
|
294
|
+
buttonText: 'Eliminar Ficheiro',
|
295
|
+
iconPrev: faTrash,
|
296
|
+
},
|
297
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
298
|
+
}
|
299
|
+
|
300
|
+
export const Gravar_Projeto: Story = {
|
301
|
+
args: {
|
302
|
+
variant: 'cui-actions',
|
303
|
+
mode: 'cui-save_project',
|
304
|
+
size: 'cui-sm',
|
305
|
+
buttonText: 'Gravar Projeto',
|
306
|
+
iconPrev: faFloppyDisk,
|
307
|
+
},
|
308
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
309
|
+
}
|
310
|
+
|
311
|
+
export const Eliminar_projeto: Story = {
|
312
|
+
args: {
|
313
|
+
variant: 'cui-actions',
|
314
|
+
mode: 'cui-delete_project',
|
315
|
+
size: 'cui-sm',
|
316
|
+
buttonText: 'Eliminar Projeto',
|
317
|
+
iconPrev: faTrash,
|
318
|
+
},
|
319
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
320
|
+
}
|
321
|
+
|
322
|
+
export const Escolher_ficheiro: Story = {
|
323
|
+
args: {
|
324
|
+
variant: 'cui-actions',
|
325
|
+
mode: 'cui-choose_file',
|
326
|
+
size: 'cui-lg',
|
327
|
+
buttonText: 'Escolher Ficheiro',
|
328
|
+
iconTop: faUpload,
|
329
|
+
},
|
330
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
331
|
+
}
|
332
|
+
|
333
|
+
export const Logout: Story = {
|
334
|
+
args: {
|
335
|
+
variant: 'cui-user_actions',
|
336
|
+
mode: 'cui-logout',
|
337
|
+
size: 'cui-lg',
|
338
|
+
buttonText: 'Teminar Sessão',
|
339
|
+
iconPrev: faSignOut,
|
340
|
+
},
|
341
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
342
|
+
}
|
343
|
+
|
344
|
+
export const Login: Story = {
|
345
|
+
args: {
|
346
|
+
variant: 'cui-user_actions',
|
347
|
+
mode: 'cui-login',
|
348
|
+
size: 'cui-lg',
|
349
|
+
buttonText: 'Iniciar Sessão',
|
350
|
+
iconPrev: faSignOut,
|
351
|
+
},
|
352
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
353
|
+
}
|
354
|
+
|
355
|
+
export const LoginMicrosoft: Story = {
|
356
|
+
args: {
|
357
|
+
variant: 'cui-user_actions',
|
358
|
+
mode: 'cui-login_microsoft',
|
359
|
+
size: 'cui-lg',
|
360
|
+
buttonText: 'Sign in with Microsoft',
|
361
|
+
iconPrev: faMicrosoft,
|
362
|
+
},
|
363
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
364
|
+
}
|
365
|
+
|
366
|
+
export const Escolher_operadoras: Story = {
|
367
|
+
args: {
|
368
|
+
variant: 'cui-actions',
|
369
|
+
mode: 'cui-options_home_screen',
|
370
|
+
size: 'cui-ext_lg',
|
371
|
+
buttonText: 'Operadoras',
|
372
|
+
iconTop: faWifi,
|
373
|
+
},
|
374
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
375
|
+
}
|
376
|
+
|
377
|
+
export const Gerir_projetos: Story = {
|
378
|
+
args: {
|
379
|
+
variant: 'cui-actions',
|
380
|
+
mode: 'cui-options_home_screen',
|
381
|
+
size: 'cui-ext_lg',
|
382
|
+
buttonText: 'Gestão de Projetos',
|
383
|
+
iconPrev: faTableCells,
|
384
|
+
},
|
385
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
386
|
+
}
|
387
|
+
|
388
|
+
export const Historico: Story = {
|
389
|
+
args: {
|
390
|
+
variant: 'cui-actions',
|
391
|
+
mode: 'cui-options_home_screen',
|
392
|
+
size: 'cui-ext_lg',
|
393
|
+
buttonText: 'Histórico',
|
394
|
+
iconTop: faClockRotateLeft,
|
395
|
+
},
|
396
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
397
|
+
}
|
398
|
+
|
399
|
+
export const Tabs: Story = {
|
400
|
+
args: {
|
401
|
+
variant: 'cui-tabs',
|
402
|
+
mode: 'cui-project_and_operator_options',
|
403
|
+
size: 'cui-lg',
|
404
|
+
buttonText: 'Ficheiros',
|
405
|
+
iconPrev: faFile,
|
406
|
+
},
|
407
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
408
|
+
}
|
409
|
+
|
410
|
+
export const FiltersUnselected: Story = {
|
411
|
+
args: {
|
412
|
+
variant: 'cui-filters',
|
413
|
+
size: 'cui-sm',
|
414
|
+
selected: false,
|
415
|
+
buttonText: 'Juntas',
|
416
|
+
iconNext: faCircle,
|
417
|
+
},
|
418
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
419
|
+
}
|
420
|
+
|
421
|
+
export const FiltersSelected: Story = {
|
422
|
+
args: {
|
423
|
+
variant: 'cui-filters',
|
424
|
+
size: 'cui-sm',
|
425
|
+
selected: true,
|
426
|
+
buttonText: 'Juntas',
|
427
|
+
iconNext: faCircleCheck,
|
428
|
+
},
|
429
|
+
render: ({ buttonText, ...args }) => <Button {...args}>{buttonText}</Button>,
|
430
|
+
}
|
431
|
+
|
432
|
+
*/
|
@@ -1,14 +1,5 @@
|
|
1
|
-
import type { Meta
|
1
|
+
import type { Meta } from '@storybook/react';
|
2
2
|
import Select from './Select';
|
3
3
|
import './Select.scss';
|
4
4
|
declare const meta: Meta<typeof Select>;
|
5
5
|
export default meta;
|
6
|
-
type Story = StoryObj<typeof meta>;
|
7
|
-
export declare const Default: Story;
|
8
|
-
export declare const Disabled: Story;
|
9
|
-
export declare const SmallContainer: Story;
|
10
|
-
export declare const LargeContainer: Story;
|
11
|
-
export declare const NoOptions: Story;
|
12
|
-
export declare const LongPlaceholder: Story;
|
13
|
-
export declare const Responsive: Story;
|
14
|
-
export declare const WithSelectedValue: Story;
|
@@ -6,16 +6,6 @@ type StoryProps = ComponentProps<typeof Stack> & {
|
|
6
6
|
};
|
7
7
|
declare const meta: Meta<StoryProps>;
|
8
8
|
export default meta;
|
9
|
-
type Story = StoryObj<
|
10
|
-
declare const Tabulador_operadoras: StoryObj;
|
9
|
+
type Story = StoryObj<StoryProps>;
|
11
10
|
export declare const Horizontal: Story;
|
12
11
|
export declare const Vertical: Story;
|
13
|
-
export declare const Wrapped: Story;
|
14
|
-
export declare const Empty: Story;
|
15
|
-
export declare const Tabulador_projeto: Story;
|
16
|
-
export declare const Tabulador_operadora: Story;
|
17
|
-
export declare const Tabulador_filtros_operadora_componentes: Story;
|
18
|
-
export declare const Tabulador_filtros_projetos_ficheiros: Story;
|
19
|
-
export declare const Tabulador_filtros_proj_BoM: Story;
|
20
|
-
export declare const Tabulador_historico_modos: Story;
|
21
|
-
export { Tabulador_operadoras };
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { PropsWithChildren } from 'react';
|
3
2
|
import { LoggedUser } from '../../../types/LoggedUser';
|
4
3
|
import './Header.scss';
|
5
|
-
type Props =
|
4
|
+
type Props = {
|
6
5
|
user: LoggedUser;
|
7
6
|
returnToHome: () => void;
|
8
7
|
returnLogout: () => void;
|
@@ -10,6 +9,6 @@ type Props = PropsWithChildren<{
|
|
10
9
|
homeTextImg?: string;
|
11
10
|
logoImg?: string;
|
12
11
|
title?: string;
|
13
|
-
}
|
12
|
+
};
|
14
13
|
declare const Header: ({ returnToHome, returnLogout, homeImg, homeTextImg, logoImg, title, user, }: Props) => React.JSX.Element;
|
15
14
|
export default Header;
|
@@ -1,8 +1,42 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import React from 'react';
|
2
|
+
import { StoryObj } from '@storybook/react';
|
3
3
|
import Header from './Header';
|
4
|
-
type
|
5
|
-
declare const
|
6
|
-
|
7
|
-
|
4
|
+
type Story = StoryObj<typeof Header>;
|
5
|
+
declare const _default: {
|
6
|
+
component: ({ returnToHome, returnLogout, homeImg, homeTextImg, logoImg, title, user, }: {
|
7
|
+
user: import("../../..").LoggedUser;
|
8
|
+
returnToHome: () => void;
|
9
|
+
returnLogout: () => void;
|
10
|
+
homeImg?: string;
|
11
|
+
homeTextImg?: string;
|
12
|
+
logoImg?: string;
|
13
|
+
title?: string;
|
14
|
+
}) => React.JSX.Element;
|
15
|
+
title: string;
|
16
|
+
tags: string[];
|
17
|
+
argTypes: {
|
18
|
+
user: {
|
19
|
+
control: "object";
|
20
|
+
};
|
21
|
+
returnToHome: {
|
22
|
+
action: string;
|
23
|
+
};
|
24
|
+
returnLogout: {
|
25
|
+
action: string;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
args: {
|
29
|
+
user: {
|
30
|
+
name: string;
|
31
|
+
id: string;
|
32
|
+
};
|
33
|
+
returnToHome: () => void;
|
34
|
+
returnLogout: () => void;
|
35
|
+
homeImg: string;
|
36
|
+
logoImg: string;
|
37
|
+
homeTextImg: string;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
export default _default;
|
8
41
|
export declare const LoggedIn: Story;
|
42
|
+
export declare const WithLongUserName: Story;
|
@@ -1,15 +1,77 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
import React, { useEffect } from 'react'
|
3
|
+
import InfiniteScroll from 'react-infinite-scroll-component'
|
4
|
+
import { useApi } from '../../../hooks/useApi'
|
5
|
+
|
2
6
|
interface LazyLoadListProps {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
[key: string]: string;
|
12
|
-
};
|
7
|
+
items: any[]
|
8
|
+
setItems: (items: any[]) => void
|
9
|
+
page: number
|
10
|
+
limit: number
|
11
|
+
setPage: (page: number) => void
|
12
|
+
hasMore: boolean
|
13
|
+
setHasMore: (hasMore: boolean) => void
|
14
|
+
filters: { [key: string]: string }
|
13
15
|
}
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
const LazyLoadList: React.FC<LazyLoadListProps> = ({
|
18
|
+
items,
|
19
|
+
setItems,
|
20
|
+
page,
|
21
|
+
limit,
|
22
|
+
setPage,
|
23
|
+
hasMore,
|
24
|
+
setHasMore,
|
25
|
+
filters,
|
26
|
+
}) => {
|
27
|
+
const { request, errors, loading } = useApi()
|
28
|
+
|
29
|
+
const fetchData = async (pageNum: number) => {
|
30
|
+
const response = await request({
|
31
|
+
method: 'get',
|
32
|
+
url: `/api/items`,
|
33
|
+
params: { page: pageNum, limit, ...filters },
|
34
|
+
})
|
35
|
+
|
36
|
+
if (response) {
|
37
|
+
if (response.length === 0) {
|
38
|
+
setHasMore(false)
|
39
|
+
return
|
40
|
+
}
|
41
|
+
setItems([...items, ...response])
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
useEffect(() => {
|
46
|
+
fetchData(page)
|
47
|
+
}, [page, filters])
|
48
|
+
|
49
|
+
const loadMore = () => {
|
50
|
+
setPage(page + 1)
|
51
|
+
}
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div>
|
55
|
+
{errors && errors}
|
56
|
+
<InfiniteScroll
|
57
|
+
dataLength={items.length}
|
58
|
+
next={loadMore}
|
59
|
+
hasMore={hasMore}
|
60
|
+
loader={<h4>Loading...</h4>}
|
61
|
+
endMessage={<p>No more items to load</p>}
|
62
|
+
>
|
63
|
+
{items.map((item, index) => (
|
64
|
+
<div
|
65
|
+
key={index}
|
66
|
+
style={{ padding: '20px', borderBottom: '1px solid #ccc' }}
|
67
|
+
>
|
68
|
+
{item.name || `Item ${index}`}{' '}
|
69
|
+
</div>
|
70
|
+
))}
|
71
|
+
</InfiniteScroll>
|
72
|
+
</div>
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
export default LazyLoadList
|
77
|
+
*/
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
2
2
|
import Profile from './Profile';
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
export
|
7
|
-
|
8
|
-
export declare const ProfileStory: Story;
|
3
|
+
type Story = StoryObj<typeof Profile>;
|
4
|
+
declare const _default: Meta<typeof Profile>;
|
5
|
+
export default _default;
|
6
|
+
export declare const Default: Story;
|
7
|
+
export declare const WithLongName: Story;
|