@pplancq/react-template 2.8.17 → 2.9.0

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/_README.md +57 -52
  3. package/mise.toml +2 -2
  4. package/package.json +25 -24
  5. package/scripts/removeDemo.cjs +105 -66
  6. package/src/README.md +81 -0
  7. package/src/app/App.tsx +18 -0
  8. package/src/{bootstrap.tsx → app/AppHTMLElement.tsx} +2 -2
  9. package/src/app/README.md +69 -0
  10. package/src/{__tests__/bootstraps.test.tsx → app/__tests__/AppHTMLElement.test.tsx} +5 -5
  11. package/src/app/config/serviceContainer.ts +6 -0
  12. package/src/app/providers/Providers/Providers.tsx +18 -0
  13. package/src/{providers → app/providers}/QueryClientProvider/QueryClientProvider.tsx +3 -3
  14. package/src/app/providers/ServiceProvider/ServiceContext.ts +8 -0
  15. package/src/app/providers/ServiceProvider/ServiceProvider.tsx +14 -0
  16. package/src/app/routing/Router.tsx +14 -0
  17. package/src/app/routing/appRoutes.ts +3 -0
  18. package/src/app/routing/routes.tsx +9 -0
  19. package/src/demo/README.md +148 -0
  20. package/src/demo/application/dtos/ArchitecturePrinciple.ts +5 -0
  21. package/src/{types/profileTypes.ts → demo/application/dtos/ProfileFormValues.ts} +1 -1
  22. package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCase.ts +11 -0
  23. package/src/demo/application/use-cases/GetArchitecturePrinciplesUseCaseInterface.ts +5 -0
  24. package/src/demo/application/use-cases/GetDemoUsersUseCase.ts +11 -0
  25. package/src/demo/application/use-cases/GetDemoUsersUseCaseInterface.ts +5 -0
  26. package/src/demo/domain/entities/DemoUser.ts +7 -0
  27. package/src/demo/domain/repositories/ArchitecturePrincipleRepositoryInterface.d.ts +5 -0
  28. package/src/demo/domain/repositories/DemoUserRepositoryInterface.d.ts +5 -0
  29. package/src/demo/infrastructure/repositories/HttpDemoUserRepository.ts +29 -0
  30. package/src/demo/infrastructure/repositories/StaticArchitecturePrincipleRepository.ts +33 -0
  31. package/src/demo/serviceDemo.ts +39 -0
  32. package/src/demo/serviceIdentifiers.ts +6 -0
  33. package/src/demo/ui/components/DemoFooter/DemoFooter.tsx +17 -0
  34. package/src/{components/Footer → demo/ui/components/DemoFooter}/__tests__/Footer.test.tsx +2 -2
  35. package/src/{components/Footer → demo/ui/components/DemoFooter}/__tests__/__snapshots__/Footer.test.tsx.snap +3 -3
  36. package/src/demo/ui/components/DemoFooter/index.ts +1 -0
  37. package/src/demo/ui/components/DemoHeader/DemoHeader.tsx +25 -0
  38. package/src/{components/Header → demo/ui/components/DemoHeader}/__tests__/Header.test.tsx +2 -2
  39. package/src/demo/ui/components/DemoHeader/__tests__/__snapshots__/Header.test.tsx.snap +64 -0
  40. package/src/demo/ui/components/DemoHeader/index.ts +1 -0
  41. package/src/{ui/molecules/Navigation/Navigation.tsx → demo/ui/components/DemoNavigation/DemoNavigation.tsx} +4 -4
  42. package/src/demo/ui/components/DemoNavigation/index.ts +1 -0
  43. package/src/{components → demo/ui/components}/TextInput/TextInput.tsx +3 -3
  44. package/src/{forms → demo/ui/forms}/ProfileForm/ProfileForm.tsx +7 -7
  45. package/src/demo/ui/hooks/useDemoUsersQuery/useDemoUsersQuery.ts +13 -0
  46. package/src/demo/ui/layouts/DemoLayout/DemoLayout.tsx +12 -0
  47. package/src/demo/ui/layouts/MainTemplate/MainTemplate.module.css +21 -0
  48. package/src/{ui/templates → demo/ui/layouts}/MainTemplate/MainTemplate.tsx +7 -7
  49. package/src/demo/ui/pages/DemoHome/DemoHome.tsx +117 -0
  50. package/src/demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.tsx +47 -0
  51. package/src/{pages/Demo → demo/ui/pages}/ReactHookFormDemo/ReactHookFormDemo.tsx +7 -7
  52. package/src/demo/ui/pages/ReactQueryDemo/ReactQueryDemo.module.scss +38 -0
  53. package/src/{pages/Demo → demo/ui/pages}/ReactQueryDemo/ReactQueryDemo.tsx +5 -4
  54. package/src/demo/ui/routing/demoAppRoutes.ts +6 -0
  55. package/src/demo/ui/routing/demoRoutes.tsx +31 -0
  56. package/src/main.ts +2 -2
  57. package/src/shared/README.md +53 -0
  58. package/src/shared/application/README.md +49 -0
  59. package/src/shared/domain/README.md +52 -0
  60. package/src/shared/infrastructure/README.md +51 -0
  61. package/src/{api → shared/infrastructure/http}/fetchApi.ts +1 -1
  62. package/src/shared/ui/README.md +50 -0
  63. package/src/shared/ui/hooks/useService/useService.ts +13 -0
  64. package/tsconfig.json +3 -1
  65. package/vitest.config.mts +5 -1
  66. package/src/api/README.md +0 -65
  67. package/src/api/demoApi.ts +0 -10
  68. package/src/assets/README.md +0 -54
  69. package/src/components/App/App.tsx +0 -18
  70. package/src/components/App/index.ts +0 -1
  71. package/src/components/Footer/Footer.tsx +0 -16
  72. package/src/components/Footer/index.ts +0 -1
  73. package/src/components/Header/Header.tsx +0 -17
  74. package/src/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +0 -37
  75. package/src/components/Header/index.ts +0 -1
  76. package/src/components/README.md +0 -33
  77. package/src/config/README.md +0 -63
  78. package/src/config/index.ts +0 -1
  79. package/src/forms/README.md +0 -142
  80. package/src/hooks/README.md +0 -83
  81. package/src/hooks/api/queryKey.ts +0 -1
  82. package/src/hooks/api/useDemoApi.ts +0 -16
  83. package/src/pages/Demo/Demo.tsx +0 -236
  84. package/src/pages/Demo/ReactHookFormDemo/index.ts +0 -1
  85. package/src/pages/Demo/ReactHookFormDemo/routes.tsx +0 -7
  86. package/src/pages/Demo/ReactQueryDemo/index.ts +0 -1
  87. package/src/pages/Demo/ReactQueryDemo/routes.tsx +0 -7
  88. package/src/pages/Demo/__tests__/Demo.test.tsx +0 -15
  89. package/src/pages/Demo/__tests__/__snapshots__/Demo.test.tsx.snap +0 -557
  90. package/src/pages/Demo/index.ts +0 -1
  91. package/src/pages/Demo/routes.tsx +0 -8
  92. package/src/pages/Layout/Layout.tsx +0 -12
  93. package/src/pages/Layout/index.ts +0 -1
  94. package/src/pages/README.md +0 -91
  95. package/src/pages/UnexpectedError/UnexpectedError.module.css +0 -8
  96. package/src/pages/UnexpectedError/UnexpectedError.tsx +0 -22
  97. package/src/pages/UnexpectedError/index.ts +0 -1
  98. package/src/providers/QueryClientProvider/index.ts +0 -1
  99. package/src/providers/README.md +0 -112
  100. package/src/providers/index.ts +0 -1
  101. package/src/providers/withProviders/index.ts +0 -1
  102. package/src/providers/withProviders/withProviders.tsx +0 -18
  103. package/src/routing/README.md +0 -76
  104. package/src/routing/appRoutes.ts +0 -5
  105. package/src/routing/routerFactory.ts +0 -12
  106. package/src/routing/routes.tsx +0 -13
  107. package/src/types/README.md +0 -62
  108. package/src/types/demoApi.ts +0 -25
  109. package/src/ui/README.md +0 -144
  110. package/src/ui/molecules/Navigation/index.ts +0 -1
  111. package/src/ui/organisms/Footer/Footer.module.css +0 -10
  112. package/src/ui/organisms/Footer/Footer.tsx +0 -10
  113. package/src/ui/organisms/Footer/index.ts +0 -1
  114. package/src/ui/organisms/Header/Header.module.css +0 -17
  115. package/src/ui/organisms/Header/Header.tsx +0 -16
  116. package/src/ui/organisms/Header/index.ts +0 -1
  117. package/src/ui/organisms/MainContent/MainContent.module.css +0 -3
  118. package/src/ui/organisms/MainContent/MainContent.tsx +0 -6
  119. package/src/ui/organisms/MainContent/index.ts +0 -1
  120. package/src/ui/templates/MainTemplate/MainTemplate.module.css +0 -5
  121. package/src/utils/README.md +0 -70
  122. /package/src/{assets → app/assets}/css/index.ts +0 -0
  123. /package/src/{assets → app/assets}/css/mainBody.css +0 -0
  124. /package/src/{assets → app/assets}/css/reset.css +0 -0
  125. /package/src/{config → app/config}/queryClientConfig.ts +0 -0
  126. /package/src/{assets → demo/ui/assets}/images/logo.png +0 -0
  127. /package/src/{assets → demo/ui/assets}/images/templatePlugins.png +0 -0
  128. /package/src/{components/Footer/Footer.module.css → demo/ui/components/DemoFooter/DemoFooter.module.css} +0 -0
  129. /package/src/{components/Header/Header.module.css → demo/ui/components/DemoHeader/DemoHeader.module.css} +0 -0
  130. /package/src/{ui/molecules/Navigation/Navigation.module.css → demo/ui/components/DemoNavigation/DemoNavigation.module.css} +0 -0
  131. /package/src/{ui/atoms → demo/ui/components}/Input/Input.module.scss +0 -0
  132. /package/src/{ui/atoms → demo/ui/components}/Input/Input.tsx +0 -0
  133. /package/src/{ui/atoms → demo/ui/components}/Input/index.ts +0 -0
  134. /package/src/{ui/atoms → demo/ui/components}/Logo/Logo.module.css +0 -0
  135. /package/src/{ui/atoms → demo/ui/components}/Logo/Logo.tsx +0 -0
  136. /package/src/{ui/atoms → demo/ui/components}/Logo/__tests__/Logo.test.tsx +0 -0
  137. /package/src/{ui/atoms → demo/ui/components}/Logo/index.ts +0 -0
  138. /package/src/{ui/atoms → demo/ui/components}/NavLink/NavLink.tsx +0 -0
  139. /package/src/{ui/atoms → demo/ui/components}/NavLink/index.ts +0 -0
  140. /package/src/{components → demo/ui/components}/TextInput/index.ts +0 -0
  141. /package/src/{forms → demo/ui/forms}/ProfileForm/ProfileForm.module.scss +0 -0
  142. /package/src/{forms → demo/ui/forms}/ProfileForm/index.ts +0 -0
  143. /package/src/{ui/templates → demo/ui/layouts}/MainTemplate/index.ts +0 -0
  144. /package/src/{pages/Demo/Demo.module.scss → demo/ui/pages/DemoHome/DemoHome.module.scss} +0 -0
  145. /package/src/{pages/Demo/ReactQueryDemo/ReactQueryDemo.module.scss → demo/ui/pages/DependencyInjectionDemo/DependencyInjectionDemo.module.scss} +0 -0
  146. /package/src/{pages/Demo/ReactHookFormDemo/ReactHookFormDemo.module.css → demo/ui/pages/ReactHookFormDemo/ReactHookFormDemo.module.scss} +0 -0
  147. /package/src/{api → shared/infrastructure/http}/constant.ts +0 -0
  148. /package/src/{types/api.ts → shared/infrastructure/http/fetchApi.type.d.ts} +0 -0
@@ -1,557 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`Demo Component > should render the Demo component correctly 1`] = `
4
- <div>
5
- <div
6
- class="_container_af1029"
7
- >
8
- <div
9
- class="_bigTitleStyle_af1029"
10
- >
11
- Welcome to Your React Starter Kit
12
- <span>
13
- Welcome
14
- </span>
15
- </div>
16
- <div
17
- class="_foo_af1029"
18
- >
19
- FlexBlug
20
- </div>
21
- <div
22
- class="_paragraphContainer_af1029"
23
- >
24
- <h1
25
- class="_titleStyle_af1029"
26
- >
27
- Overview
28
- </h1>
29
- <div
30
- class="_infoSection_af1029"
31
- >
32
- <span
33
- class="_centredText_af1029"
34
- >
35
- <p
36
- class="_paragraphStyle_af1029"
37
- >
38
- <span
39
- class="_highlight_af1029"
40
- >
41
- Congratulations
42
- </span>
43
- on starting your project with our
44
-
45
- <span
46
- class="_highlight_af1029"
47
- >
48
- React Starter Kit!
49
- </span>
50
- This kit is designed to jumpstart your development with a well-organized project structure and pre-configured tools.
51
- </p>
52
- <p
53
- class="_paragraphStyle_af1029"
54
- >
55
- Below, you'll find an overview of the key features, tools, and architecture used in this starter kit.
56
- </p>
57
- </span>
58
- </div>
59
- </div>
60
- <img
61
- alt="template"
62
- class="_imagePlace_af1029"
63
- src="/src/assets/images/templatePlugins.png"
64
- />
65
- <div
66
- class="_paragraphContainer_af1029"
67
- >
68
- <h1
69
- class="_titleStyle_af1029"
70
- >
71
- Objective
72
- </h1>
73
- <div
74
- class="_infoSection_af1029"
75
- >
76
- <p
77
- class="_paragraphStyle_af1029"
78
- >
79
- The goal of this
80
- <span
81
- class="_boldText_af1029"
82
- >
83
- starter kit
84
- </span>
85
- is to enable you to quickly start a new project with all the necessary tools.
86
- </p>
87
- <p
88
- class="_paragraphStyle_af1029"
89
- >
90
- Additionally, this
91
- <span
92
- class="_boldText_af1029"
93
- >
94
- starter kit
95
- </span>
96
- offers a robust set of options for structuring your
97
- <span
98
- class="_boldText_af1029"
99
- >
100
- React application
101
- </span>
102
- , providing flexibility to adapt to various project architectures.
103
- </p>
104
- <p
105
- class="_paragraphStyle_af1029"
106
- >
107
- It has been thoughtfully designed not only to expedite the initial setup but also to streamline the implementation of
108
- <span
109
- class="_highlight_af1029"
110
- >
111
- Micro-Frontends
112
- </span>
113
- , making it a versatile solution for projects of different scales. (for more details check the
114
-
115
- <span
116
- class="_highlight_af1029"
117
- >
118
- README.md
119
- </span>
120
- file)
121
- </p>
122
- </div>
123
- </div>
124
- <div
125
- class="_paragraphContainer_af1029"
126
- >
127
- <h1
128
- class="_titleStyle_af1029"
129
- >
130
- Features
131
- </h1>
132
- <div
133
- class="_infoSection_af1029"
134
- >
135
- <p
136
- class="_paragraphStyle_af1029"
137
- >
138
- <span
139
- class="_boldText_af1029"
140
- >
141
- React:
142
- </span>
143
- A JavaScript library for building user interfaces.
144
- </p>
145
- </div>
146
- <div
147
- class="_infoSection_af1029"
148
- >
149
- <p
150
- class="_paragraphStyle_af1029"
151
- >
152
- <span
153
- class="_boldText_af1029"
154
- >
155
- TypeScript:
156
- </span>
157
- A superset of JavaScript that adds static typing.
158
- </p>
159
- </div>
160
- <div
161
- class="_infoSection_af1029"
162
- >
163
- <p
164
- class="_paragraphStyle_af1029"
165
- >
166
- <span
167
- class="_boldText_af1029"
168
- >
169
- React Query:
170
- </span>
171
- A library for managing, caching, and updating server state in React applications. (for more details check the
172
-
173
- <span
174
- class="_highlight_af1029"
175
- >
176
- README.md
177
- </span>
178
- file under the
179
-
180
- <span
181
- class="_boldText_af1029"
182
- >
183
- hooks
184
- </span>
185
- folder)
186
- </p>
187
- <div
188
- class="_demoStyle_af1029"
189
- >
190
- <a
191
- class="_a_af1029"
192
- data-discover="true"
193
- href="/reactQueryDemo"
194
- >
195
- Run Demo
196
- </a>
197
- </div>
198
- </div>
199
- <div
200
- class="_infoSection_af1029"
201
- >
202
- <p
203
- class="_paragraphStyle_af1029"
204
- >
205
- <span
206
- class="_boldText_af1029"
207
- >
208
- React Hook Form:
209
- </span>
210
- A library for managing forms with React hooks. (for more details check the
211
- <span
212
- class="_highlight_af1029"
213
- >
214
- README.md
215
- </span>
216
- file under the
217
-
218
- <span
219
- class="_boldText_af1029"
220
- >
221
- forms
222
- </span>
223
- folder)
224
- </p>
225
- <div
226
- class="_demoStyle_af1029"
227
- >
228
- <a
229
- class="_a_af1029"
230
- data-discover="true"
231
- href="/reactHookFormDemo"
232
- >
233
- Run Demo
234
- </a>
235
- </div>
236
- </div>
237
- <div
238
- class="_infoSection_af1029"
239
- >
240
- <p
241
- class="_paragraphStyle_af1029"
242
- >
243
- <span
244
- class="_boldText_af1029"
245
- >
246
- React Router:
247
- </span>
248
- A declarative routing solution for React. (for more details check the
249
- <span
250
- class="_highlight_af1029"
251
- >
252
- README.md
253
- </span>
254
- file under the
255
-
256
- <span
257
- class="_boldText_af1029"
258
- >
259
- routing
260
- </span>
261
- folder)
262
- </p>
263
- </div>
264
- <div
265
- class="_infoSection_af1029"
266
- >
267
- <p
268
- class="_paragraphStyle_af1029"
269
- >
270
- <span
271
- class="_boldText_af1029"
272
- >
273
- ...and more:
274
- </span>
275
- Explore the
276
-
277
- <span
278
- class="_highlight_af1029"
279
- >
280
- Package.json
281
- </span>
282
- file to see additional dependencies.
283
- </p>
284
- </div>
285
- </div>
286
- <div
287
- class="_paragraphContainer_af1029"
288
- >
289
- <h1
290
- class="_titleStyle_af1029"
291
- >
292
- Project Structure
293
- </h1>
294
- <div
295
- class="_infoSection_af1029"
296
- >
297
- <div
298
- class="_tableWrapper_af1029"
299
- >
300
- <table>
301
- <thead>
302
- <tr>
303
- <th>
304
- Folder
305
- </th>
306
- <th>
307
- Description
308
- </th>
309
- </tr>
310
- </thead>
311
- <tbody>
312
- <tr>
313
- <td>
314
- <span
315
- class="_boldText_af1029"
316
- >
317
- api
318
- </span>
319
- </td>
320
- <td>
321
- Place your API-related code here.
322
- </td>
323
- </tr>
324
- <tr>
325
- <td>
326
- <span
327
- class="_boldText_af1029"
328
- >
329
- assets
330
- </span>
331
- </td>
332
- <td>
333
- Store your static assets (images, fonts, etc.) in this directory.
334
- </td>
335
- </tr>
336
- <tr>
337
- <td>
338
- <span
339
- class="_boldText_af1029"
340
- >
341
- components
342
- </span>
343
- </td>
344
- <td>
345
- Reusable React components go here.
346
- </td>
347
- </tr>
348
- <tr>
349
- <td>
350
- <span
351
- class="_boldText_af1029"
352
- >
353
- config
354
- </span>
355
- </td>
356
- <td>
357
- Configuration files and environment variables are managed here.
358
- </td>
359
- </tr>
360
- <tr>
361
- <td>
362
- <span
363
- class="_boldText_af1029"
364
- >
365
- forms
366
- </span>
367
- </td>
368
- <td>
369
- Define your forms using React Hook Form.
370
- </td>
371
- </tr>
372
- <tr>
373
- <td>
374
- <span
375
- class="_boldText_af1029"
376
- >
377
- hooks
378
- </span>
379
- </td>
380
- <td>
381
- Custom React hooks to share logic across components.
382
- </td>
383
- </tr>
384
- <tr>
385
- <td>
386
- <span
387
- class="_boldText_af1029"
388
- >
389
- pages
390
- </span>
391
- </td>
392
- <td>
393
- React components that represent individual pages or views.
394
- </td>
395
- </tr>
396
- <tr>
397
- <td>
398
- <span
399
- class="_boldText_af1029"
400
- >
401
- providers
402
- </span>
403
- </td>
404
- <td>
405
- React context providers for state management.
406
- </td>
407
- </tr>
408
- <tr>
409
- <td>
410
- <span
411
- class="_boldText_af1029"
412
- >
413
- routing
414
- </span>
415
- </td>
416
- <td>
417
- Configure your application routes here.
418
- </td>
419
- </tr>
420
- <tr>
421
- <td>
422
- <span
423
- class="_boldText_af1029"
424
- >
425
- types
426
- </span>
427
- </td>
428
- <td>
429
- TypeScript type definitions.
430
- </td>
431
- </tr>
432
- <tr>
433
- <td>
434
- <span
435
- class="_boldText_af1029"
436
- >
437
- ui
438
- </span>
439
- </td>
440
- <td>
441
- Presentational components and styles.
442
- </td>
443
- </tr>
444
- <tr>
445
- <td>
446
- <span
447
- class="_boldText_af1029"
448
- >
449
- utils
450
- </span>
451
- </td>
452
- <td>
453
- General utility functions.
454
- </td>
455
- </tr>
456
- </tbody>
457
- </table>
458
- </div>
459
- </div>
460
- </div>
461
- <div
462
- class="_paragraphContainer_af1029"
463
- >
464
- <h1
465
- class="_titleStyle_af1029"
466
- >
467
- Additional Information
468
- </h1>
469
- <div
470
- class="_infoSection_af1029"
471
- >
472
- <ul>
473
- <li>
474
- - Customize the project configuration in the
475
- <code>
476
- config
477
- </code>
478
- directory.
479
- </li>
480
- <li>
481
- - Explore the
482
- <code>
483
- utils
484
- </code>
485
- directory for utility functions.
486
- </li>
487
- <li>
488
- - Leverage React Query for efficient data fetching.
489
- </li>
490
- <li>
491
- - Take advantage of React Hook Form for managing forms seamlessly.
492
- </li>
493
- <li>
494
- - Refer to the
495
- <code>
496
- types
497
- </code>
498
- directory for TypeScript type definitions.
499
- </li>
500
- </ul>
501
- </div>
502
- <div
503
- class="_infoSection_af1029"
504
- >
505
- <span
506
- class="_centredText_af1029"
507
- >
508
- <p
509
- class="_paragraphStyle_af1029"
510
- >
511
- Our project is organized into various folders, each containing its own
512
-
513
- <span
514
- class="_highlight_af1029"
515
- >
516
- README.md
517
- </span>
518
- file with specific details, instructions, and additional information. This documentation will guide you through setting up the environment, understanding the project structure, and using the available components and features. For more details, check the
519
- <span
520
- class="_highlight_af1029"
521
- >
522
- README.md
523
- </span>
524
- file in
525
-
526
- <span
527
- class="_boldText_af1029"
528
- >
529
- each folder of the project
530
- </span>
531
- .
532
- </p>
533
- </span>
534
- </div>
535
- <div
536
- class="_infoSection_af1029"
537
- >
538
- <span
539
- class="_centredText_af1029"
540
- >
541
- <p
542
- class="_paragraphStyle_af1029"
543
- >
544
- Feel free to explore and modify the structure to suit your project's needs.
545
-
546
- <span
547
- class="_boldText_af1029"
548
- >
549
- Happy coding!
550
- </span>
551
- </p>
552
- </span>
553
- </div>
554
- </div>
555
- </div>
556
- </div>
557
- `;
@@ -1 +0,0 @@
1
- export { demoRoutes } from './routes';
@@ -1,8 +0,0 @@
1
- import { reactHookFormDemoRoutes } from '@Front/pages/Demo/ReactHookFormDemo';
2
- import { RouteObject } from 'react-router';
3
- import { Demo } from './Demo';
4
- import { reactQueryDemoRoutes } from './ReactQueryDemo';
5
-
6
- export const demoRoutes: RouteObject = {
7
- children: [{ index: true, element: <Demo /> }, reactQueryDemoRoutes, reactHookFormDemoRoutes],
8
- };
@@ -1,12 +0,0 @@
1
- import { Footer } from '@Front/components/Footer';
2
- import { Header } from '@Front/components/Header';
3
- import { MainTemplate } from '@Front/ui/templates/MainTemplate';
4
- import { Outlet } from 'react-router';
5
-
6
- export const Layout = () => {
7
- return (
8
- <MainTemplate headerProps={{ leftComponents: <Header /> }} footerProps={{ footerContent: <Footer /> }}>
9
- <Outlet />
10
- </MainTemplate>
11
- );
12
- };
@@ -1 +0,0 @@
1
- export { Layout } from './Layout';
@@ -1,91 +0,0 @@
1
- # 📁 pages
2
-
3
- The "pages" folder is designed to contain all the pages of our application. This structure facilitates organization, management, and navigation between the different views of our application. Additionally, if a page contains components related to its structure, we can create sub-folders to maintain order.
4
-
5
- ## 📑 Table of Contents
6
-
7
- - [Why Use a "pages" Folder](#folder-organization)
8
- - [Typical Structure of a "pages" Folder](#structure)
9
- - [Usage Example](#usage)
10
- - [Best Practice](#best-practice)
11
-
12
- ## <span id="folder-organization">Why Use a "pages" Folder?</span>
13
-
14
- 1. **Clear Organization** : By grouping all our pages in a single folder, we maintain a clear organization of our application, making it easy to find specific pages.
15
-
16
- 2. **Ease of Navigation** : A well-organized "pages" folder structure makes navigation between the views of our application easier.
17
-
18
- 3. **Reusability** : Components specific to a page can be reused in other pages, promoting code modularity.
19
-
20
- ## <span id="structure">Typical Structure of a "pages" Folder</span>
21
-
22
- The structure of a "pages" folder can vary depending on the size of your application, but here is a typical structure you might adopt:
23
-
24
- ```
25
- 📁 Pages
26
- ├── 📁 Home
27
- ├── 📁 User
28
- │ ├── 📁 UserProfile
29
- ├── 📁 Posts
30
- │ ├── 📁 Article
31
- ├── 📁 Admin
32
- ```
33
-
34
- In this structure, each page, such as "Home" or "User," is typically defined in its own file. If a page is complex and requires related components, you can create a sub-folder to maintain order related to the URL, as with "UserProfile" or "Article" in this example.
35
-
36
- ## <span id="usage">🧑🏻‍💻 Usage Example</span>
37
-
38
- Suppose we have a "UserProfile" page with a complex structure:
39
-
40
- ```
41
- 📁 UserProfile
42
- ├── 📄 index.ts
43
- ├── 📄 UserProfile.tsx
44
- ├── 📄 routes.tsx
45
- ```
46
-
47
- ```javascript
48
- // index.ts
49
- export { userProfileRoutes } from './routes';
50
-
51
- // routes.tsx (react-router v7)
52
- import { RouteObject } from 'react-router';
53
- import { UserProfile } from './UserProfile';
54
-
55
- export const userProfileRoutes: RouteObject = {
56
- path: 'user-profile',
57
- element: <UserProfile />,
58
- };
59
-
60
- // UserProfile.tsx
61
- export const UserProfile = () => {
62
- return (
63
- <div>
64
- UserProfile
65
- {/* Content of the UserProfile page */}
66
- </div>
67
- );
68
- }
69
- ```
70
-
71
- By using a "pages" folder and the ability to create sub-folders, we effectively organize our pages and their related components for better management of our application.
72
-
73
- ## <span id="best-practice">🎖️ Best Practice</span>
74
-
75
- When working with page components, it is advisable to follow these best practices to maintain a clean and organized code structure:
76
-
77
- #### - Minimize Business Logic
78
-
79
- Limit the inclusion of business logic within page components.
80
-
81
- Instead, delegate complex business logic to separate utility functions, services, or hooks. This keeps your page components focused on rendering and layout.
82
-
83
- #### - Data Presence Control
84
-
85
- Keep the logic within page components to a minimum, focusing primarily on controlling the presence of data.
86
-
87
- If data is not available or meets certain conditions, consider redirecting to a dedicated error or not-found page.
88
-
89
- ---
90
-
91
- **_By adopting these practices, you create page components that are focused on their primary responsibilities, leading to cleaner and more maintainable code._**
@@ -1,8 +0,0 @@
1
- .root {
2
- display: flex;
3
- width: 100%;
4
- padding-top: 15%;
5
- flex-direction: column;
6
- align-items: center;
7
- justify-content: center;
8
- }
@@ -1,22 +0,0 @@
1
- import logo from '@Front/assets/images/logo.png';
2
- import { Logo } from '@Front/ui/atoms/Logo';
3
- import { Link, useRouteError } from 'react-router';
4
-
5
- import classes from './UnexpectedError.module.css';
6
-
7
- export const UnexpectedError = () => {
8
- const error: unknown = useRouteError();
9
-
10
- return (
11
- <div className={classes.root}>
12
- <Link to="/">
13
- <Logo src={logo} alt="logo" />
14
- </Link>
15
- <h1>Oops!</h1>
16
- <p>Sorry, an unexpected error has occurred.</p>
17
- <p>
18
- <i>{(error as Error)?.message || (error as { statusText?: string })?.statusText}</i>
19
- </p>
20
- </div>
21
- );
22
- };