@pplancq/react-template 1.0.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 (117) hide show
  1. package/.babelrc.js +1 -0
  2. package/.commitlintrc.js +1 -0
  3. package/.editorconfig +4 -0
  4. package/.env +36 -0
  5. package/.eslintrc.js +1 -0
  6. package/.gitattributes +1 -0
  7. package/.husky/commit-msg +1 -0
  8. package/.husky/pre-commit +1 -0
  9. package/.lintstagedrc.js +5 -0
  10. package/.postcssrc.js +1 -0
  11. package/.prettierrc.js +1 -0
  12. package/.stylelintrc.js +1 -0
  13. package/CHANGELOG.md +26 -0
  14. package/LICENSE +21 -0
  15. package/README.md +221 -0
  16. package/_gitignore +26 -0
  17. package/package.json +84 -0
  18. package/public/favicon.ico +0 -0
  19. package/public/index.html +17 -0
  20. package/src/api/README.md +64 -0
  21. package/src/api/demoApi.ts +44 -0
  22. package/src/assets/README.md +51 -0
  23. package/src/assets/css/index.ts +2 -0
  24. package/src/assets/css/mainBody.css +4 -0
  25. package/src/assets/css/reset.css +131 -0
  26. package/src/assets/images/logo.png +0 -0
  27. package/src/assets/images/templatePlugins.png +0 -0
  28. package/src/bootstrap.tsx +26 -0
  29. package/src/components/App/App.tsx +18 -0
  30. package/src/components/App/index.ts +1 -0
  31. package/src/components/Footer/Footer.module.css +4 -0
  32. package/src/components/Footer/Footer.tsx +16 -0
  33. package/src/components/Footer/__tests__/Footer.test.tsx +15 -0
  34. package/src/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +21 -0
  35. package/src/components/Footer/index.ts +1 -0
  36. package/src/components/Header/Header.module.css +7 -0
  37. package/src/components/Header/Header.tsx +17 -0
  38. package/src/components/Header/__tests__/Header.test.tsx +15 -0
  39. package/src/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +35 -0
  40. package/src/components/Header/index.ts +1 -0
  41. package/src/components/README.md +34 -0
  42. package/src/components/TextInput/TextInput.tsx +24 -0
  43. package/src/components/TextInput/index.ts +1 -0
  44. package/src/config/README.md +61 -0
  45. package/src/config/index.ts +1 -0
  46. package/src/config/queryClientConfig.ts +3 -0
  47. package/src/forms/ProfileForm/ProfileForm.module.scss +10 -0
  48. package/src/forms/ProfileForm/ProfileForm.tsx +51 -0
  49. package/src/forms/ProfileForm/index.ts +1 -0
  50. package/src/forms/README.md +131 -0
  51. package/src/hooks/README.md +87 -0
  52. package/src/hooks/api/queryKey.ts +1 -0
  53. package/src/hooks/api/useDemoApi.ts +16 -0
  54. package/src/main.ts +3 -0
  55. package/src/pages/Demo/Demo.module.scss +184 -0
  56. package/src/pages/Demo/Demo.tsx +237 -0
  57. package/src/pages/Demo/ReactHookFormDemo/ReactHookFormDemo.module.css +32 -0
  58. package/src/pages/Demo/ReactHookFormDemo/ReactHookFormDemo.tsx +48 -0
  59. package/src/pages/Demo/ReactHookFormDemo/index.ts +1 -0
  60. package/src/pages/Demo/ReactHookFormDemo/routes.tsx +7 -0
  61. package/src/pages/Demo/ReactQueryDemo/ReactQueryDemo.module.scss +38 -0
  62. package/src/pages/Demo/ReactQueryDemo/ReactQueryDemo.tsx +55 -0
  63. package/src/pages/Demo/ReactQueryDemo/index.ts +1 -0
  64. package/src/pages/Demo/ReactQueryDemo/routes.tsx +7 -0
  65. package/src/pages/Demo/__tests__/Demo.test.tsx +15 -0
  66. package/src/pages/Demo/__tests__/__snapshots__/Demo.test.tsx.snap +555 -0
  67. package/src/pages/Demo/index.ts +1 -0
  68. package/src/pages/Demo/routes.tsx +8 -0
  69. package/src/pages/Error/Error.module.css +8 -0
  70. package/src/pages/Error/Error.tsx +22 -0
  71. package/src/pages/Error/index.ts +1 -0
  72. package/src/pages/Layout/Layout.tsx +12 -0
  73. package/src/pages/Layout/index.ts +1 -0
  74. package/src/pages/README.md +88 -0
  75. package/src/providers/QueryClientProvider/QueryClientProvider.tsx +16 -0
  76. package/src/providers/QueryClientProvider/index.ts +1 -0
  77. package/src/providers/README.md +115 -0
  78. package/src/providers/index.ts +1 -0
  79. package/src/providers/withProviders/index.ts +1 -0
  80. package/src/providers/withProviders/withProviders.tsx +18 -0
  81. package/src/react-app-env.d.ts +3 -0
  82. package/src/routing/README.md +80 -0
  83. package/src/routing/appRoutes.ts +5 -0
  84. package/src/routing/routerFactory.ts +10 -0
  85. package/src/routing/routes.tsx +13 -0
  86. package/src/types/README.md +61 -0
  87. package/src/types/demoApi.ts +9 -0
  88. package/src/types/profileTypes.ts +5 -0
  89. package/src/ui/README.md +141 -0
  90. package/src/ui/atoms/Input/Input.module.scss +32 -0
  91. package/src/ui/atoms/Input/Input.tsx +27 -0
  92. package/src/ui/atoms/Input/index.ts +1 -0
  93. package/src/ui/atoms/Logo/Logo.module.css +3 -0
  94. package/src/ui/atoms/Logo/Logo.tsx +11 -0
  95. package/src/ui/atoms/Logo/index.ts +1 -0
  96. package/src/ui/atoms/NavLink/NavLink.tsx +8 -0
  97. package/src/ui/atoms/NavLink/index.ts +1 -0
  98. package/src/ui/molecules/Navigation/Navigation.module.css +22 -0
  99. package/src/ui/molecules/Navigation/Navigation.tsx +25 -0
  100. package/src/ui/molecules/Navigation/index.ts +1 -0
  101. package/src/ui/organisms/Footer/Footer.module.css +10 -0
  102. package/src/ui/organisms/Footer/Footer.tsx +10 -0
  103. package/src/ui/organisms/Footer/index.ts +1 -0
  104. package/src/ui/organisms/Header/Header.module.css +17 -0
  105. package/src/ui/organisms/Header/Header.tsx +16 -0
  106. package/src/ui/organisms/Header/index.ts +1 -0
  107. package/src/ui/organisms/MainContent/MainContent.module.css +3 -0
  108. package/src/ui/organisms/MainContent/MainContent.tsx +6 -0
  109. package/src/ui/organisms/MainContent/index.ts +1 -0
  110. package/src/ui/templates/MainTemplate/MainTemplate.module.css +5 -0
  111. package/src/ui/templates/MainTemplate/MainTemplate.tsx +26 -0
  112. package/src/ui/templates/MainTemplate/index.ts +1 -0
  113. package/src/utils/README.md +68 -0
  114. package/tsconfig.json +32 -0
  115. package/vitest.config.mts +49 -0
  116. package/vitest.setup.ts +1 -0
  117. package/webpack.config.js +22 -0
@@ -0,0 +1,87 @@
1
+ # 📁 hooks
2
+
3
+ The "hooks" folder is a directory you can create in your React project to group custom hooks you develop. Hooks are special functions introduced in React 16.8, allowing the management of state and lifecycle in functional components.
4
+
5
+
6
+ ## 📑 Table of Contents
7
+ - [Why Use a "hooks" Folder](#folder-organization)
8
+ - [Usage Example](#usage)
9
+ - [React-Query-Folder](#folder-react-query)
10
+
11
+ ## <span id="folder-organization">Why Use a "hooks" Folder?</span>
12
+
13
+ 1. **Code Reusability** : Custom hooks enable reusing state and lifecycle logic across multiple functional components, promoting code reuse and adhering to the DRY (Don't Repeat Yourself) principle.
14
+
15
+ 2. **Separation of Concerns** : By grouping your custom hooks in a distinct folder, you maintain a clear separation between the business logic of your application and the React components themselves.
16
+
17
+ 3. **Code Clarity** : Grouping custom hooks in a "hooks" folder simplifies code maintenance and readability, making it easier to locate and understand specific logic.
18
+
19
+
20
+ ## <span id="usage">🧑🏻‍💻 Usage Example</span>
21
+
22
+ Suppose you have a custom hook "useCustomHook1.js" in the "hooks" folder. You can import it and use it in a functional component like this :
23
+
24
+ ```javascript
25
+ import { useCustomHook1 } from './hooks/useCustomHook1';
26
+
27
+ export const MyComponent = () => {
28
+ const customData = useCustomHook1();
29
+
30
+ return (
31
+ <div>
32
+ {/* Use customData in your component */}
33
+ </div>
34
+ );
35
+ }
36
+ ```
37
+ ## <span id="folder-react-query">"api" Folder for React Query Requests</span>
38
+
39
+ Under the "hooks" folder, we have included a sub-folder "api" specifically designed to handle requests using React Query. This allows for more efficient organization of API requests, isolating them from component logic and leveraging the power of React Query for state and data caching.
40
+
41
+ The typical structure of this "api" folder might look like this:
42
+
43
+ ```
44
+ 📁 hooks
45
+ ├── 📁 api
46
+ │ ├── 📄 useUsers.ts
47
+ │ ├── 📄 usePosts.ts
48
+ ```
49
+
50
+ Each file, such as "useUsers.ts" or "usePosts.ts," contains logic to perform requests specific to a given resource. You can then use these queries in your components by importing them appropriately.
51
+
52
+ Using React Query for API request management makes data retrieval, caching, and updating easier while reducing code complexity.
53
+
54
+
55
+ ### What is React Query?
56
+
57
+ React Query is an open-source JavaScript library that simplifies data management in a React application. It provides a simple and powerful way to handle network requests, data caching, error handling, and more. With React Query, you can significantly improve the development experience of your React applications by managing data efficiently.
58
+
59
+ ### Key Features
60
+
61
+ #### 1. Query Management
62
+
63
+ - React Query simplifies making API requests by providing hooks for GET, POST, PUT, DELETE, etc.
64
+ - You can easily specify query options such as parameters, headers, and more.
65
+
66
+ #### 2. Data Caching
67
+
68
+ - Retrieved data is automatically cached, avoiding unnecessary API calls.
69
+ - Custom caching rules can be defined for each query.
70
+
71
+ #### 3. State Management
72
+
73
+ - React Query automatically manages data state, providing loading, success, and error states for each query.
74
+ - You can easily access query states in your components.
75
+
76
+ #### 4. Automatic Refetching
77
+
78
+ - React Query offers automatic data refetching, ensuring data is automatically refreshed at regular intervals, improving data freshness.
79
+
80
+ #### 5. Mutation Management
81
+
82
+ - The library also facilitates mutation management, such as creating, updating, and deleting data.
83
+ - Mutations are easy to define and manage.
84
+
85
+ ---
86
+ ***For more information and details, refer to the
87
+ [official React Query documentation.](https://tanstack.com/query/v3/)***
@@ -0,0 +1 @@
1
+ export const demoQuery = () => ['dataWithDelay'];
@@ -0,0 +1,16 @@
1
+ import { fetchDemoApi } from '@Front/api/demoApi';
2
+ import type { Users } from '@Front/types/demoApi';
3
+ import { useQuery } from 'react-query';
4
+ import { demoQuery } from './queryKey';
5
+
6
+ type UseDemoApiReturn = {
7
+ result: Users;
8
+ isLoading: boolean;
9
+ isError: boolean;
10
+ };
11
+
12
+ export const useDemoApi = (): UseDemoApiReturn => {
13
+ const { data = [], isLoading, isError } = useQuery<Users>(demoQuery(), fetchDemoApi);
14
+
15
+ return { result: data, isLoading, isError };
16
+ };
package/src/main.ts ADDED
@@ -0,0 +1,3 @@
1
+ import('./bootstrap').then(({ default: AppReact }) => {
2
+ customElements.define('app-react', AppReact);
3
+ });
@@ -0,0 +1,184 @@
1
+ .foo {
2
+ flex: 1 0 calc(1vw - 1px);
3
+ }
4
+
5
+ .container {
6
+ display: flex;
7
+ padding-top: 32px;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ justify-content: center;
11
+ }
12
+
13
+ .bigTitleStyle {
14
+ font-family: sans-serif;
15
+ font-size: 40px;
16
+ font-weight: 400;
17
+ letter-spacing: 1px;
18
+ text-align: center;
19
+ text-transform: uppercase;
20
+ color: #00008f;
21
+
22
+ span {
23
+ display: grid;
24
+ margin-top: 5px;
25
+ grid-template-columns: 1fr max-content 1fr;
26
+ grid-template-rows: 27px 0;
27
+ grid-gap: 20px;
28
+ align-items: center;
29
+ font-family: Raleway, sans-serif;
30
+ font-size: 15px;
31
+ font-weight: normal;
32
+ font-weight: 500;
33
+ letter-spacing: 2px;
34
+ text-transform: uppercase;
35
+ word-spacing: 1px;
36
+ color: #444;
37
+
38
+ &::before {
39
+ display: block;
40
+ height: 5px;
41
+ border-top: 1px solid #ccc;
42
+ border-bottom: 1px solid #ccc;
43
+ background-color: #f8f8f8;
44
+ content: '';
45
+ }
46
+
47
+ &::after {
48
+ display: block;
49
+ height: 5px;
50
+ border-top: 1px solid #ccc;
51
+ border-bottom: 1px solid #ccc;
52
+ background-color: #f8f8f8;
53
+ content: ' ';
54
+ }
55
+ }
56
+ }
57
+
58
+ .imagePlace {
59
+ width: 30%;
60
+
61
+ @media screen and (width <= 900px) {
62
+ width: 50%;
63
+ }
64
+ }
65
+
66
+ .paragraphContainer {
67
+ width: 100%;
68
+ padding-bottom: 32px;
69
+ }
70
+
71
+ .titleStyle {
72
+ position: relative;
73
+ margin-left: 8px;
74
+ padding-bottom: 10px;
75
+ font-size: 20px;
76
+ font-weight: 500;
77
+ letter-spacing: 0;
78
+ line-height: 1.5em;
79
+
80
+ &::before {
81
+ position: absolute;
82
+ bottom: 0;
83
+ left: 0;
84
+ width: 55px;
85
+ height: 5px;
86
+ background-color: #111;
87
+ content: '';
88
+ }
89
+
90
+ &::after {
91
+ position: absolute;
92
+ bottom: 2px;
93
+ left: 0;
94
+ width: 95%;
95
+ max-width: 255px;
96
+ height: 1px;
97
+ background-color: #333;
98
+ content: '';
99
+ }
100
+ }
101
+
102
+ .boldText {
103
+ font-weight: bold;
104
+ }
105
+
106
+ .centredText {
107
+ text-align: center;
108
+ }
109
+
110
+ .paragraphStyle {
111
+ padding: 12px;
112
+ font-family: sans-serif;
113
+ font-size: 16px;
114
+ }
115
+
116
+ .demoStyle {
117
+ display: flex;
118
+ justify-content: flex-end;
119
+ }
120
+
121
+ .a {
122
+ letter-spacing: 4px;
123
+ text-decoration: none;
124
+ text-transform: uppercase;
125
+ color: #00008f;
126
+ }
127
+
128
+ .a:hover {
129
+ color: black;
130
+ }
131
+
132
+ table,
133
+ th,
134
+ td {
135
+ padding: 6px;
136
+ border: 1px solid black;
137
+ font-family: sans-serif;
138
+ }
139
+
140
+ .tableWrapper {
141
+ margin: 16px;
142
+ overflow: auto;
143
+ }
144
+
145
+ table {
146
+ width: 100%;
147
+ }
148
+
149
+ .highlight {
150
+ font-weight: bold;
151
+ color: #00008f;
152
+ }
153
+
154
+ .infoSection {
155
+ margin: 16px;
156
+ margin-bottom: 20px;
157
+ padding: 16px;
158
+ border-radius: 8px;
159
+ background-color: #f5f5f5;
160
+ box-shadow: 0 4px 8px rgb(0 0 0 / 10%);
161
+
162
+ &:hover {
163
+ background-color: lightgrey;
164
+ }
165
+ }
166
+
167
+ ul {
168
+ margin: 0;
169
+ padding: 0;
170
+ list-style-type: none;
171
+ }
172
+
173
+ li {
174
+ margin-bottom: 10px;
175
+ font-family: sans-serif;
176
+ }
177
+
178
+ code {
179
+ padding: 2px 5px;
180
+ border-radius: 4px;
181
+ font-family: 'Courier New', monospace;
182
+ font-size: 14px;
183
+ background-color: #f8f9fa;
184
+ }
@@ -0,0 +1,237 @@
1
+ import image from '@Front/assets/images/templatePlugins.png';
2
+ import { approutes } from '@Front/routing/appRoutes';
3
+ import { NavLink } from '@Front/ui/atoms/NavLink';
4
+ import classes from './Demo.module.scss';
5
+
6
+ export const Demo = () => {
7
+ return (
8
+ <div className={classes.container}>
9
+ <div className={classes.bigTitleStyle}>
10
+ Welcome to Your React Starter Kit
11
+ <span>Welcome</span>
12
+ </div>
13
+
14
+ <div className={classes.foo}>FlexBlug</div>
15
+
16
+ <div className={classes.paragraphContainer}>
17
+ <h1 className={classes.titleStyle}>Overview</h1>
18
+ <div className={classes.infoSection}>
19
+ <span className={classes.centredText}>
20
+ <p className={classes.paragraphStyle}>
21
+ <span className={classes.highlight}>Congratulations</span> on starting your project with our{' '}
22
+ <span className={classes.highlight}>React Starter Kit!</span> This kit is designed to jumpstart your
23
+ development with a well-organized project structure and pre-configured tools.
24
+ </p>
25
+ <p className={classes.paragraphStyle}>
26
+ Below, you'll find an overview of the key features, tools, and architecture used in this starter kit.
27
+ </p>
28
+ </span>
29
+ </div>
30
+ </div>
31
+ <img src={image} alt="template" className={classes.imagePlace} />
32
+
33
+ <div className={classes.paragraphContainer}>
34
+ <h1 className={classes.titleStyle}>Objective</h1>
35
+ <div className={classes.infoSection}>
36
+ <p className={classes.paragraphStyle}>
37
+ The goal of this <span className={classes.boldText}>starter kit</span> is to enable you to quickly start a
38
+ new project with all the necessary tools.
39
+ </p>
40
+ <p className={classes.paragraphStyle}>
41
+ Additionally, this <span className={classes.boldText}>starter kit</span> offers a robust set of options for
42
+ structuring your <span className={classes.boldText}>React application</span>, providing flexibility to adapt
43
+ to various project architectures.
44
+ </p>
45
+ <p className={classes.paragraphStyle}>
46
+ It has been thoughtfully designed not only to expedite the initial setup but also to streamline the
47
+ implementation of <span className={classes.highlight}>Micro-Frontends</span>, making it a versatile solution
48
+ for projects of different scales. (for more details check the{' '}
49
+ <span className={classes.highlight}>README.md</span> file)
50
+ </p>
51
+ </div>
52
+ </div>
53
+
54
+ <div className={classes.paragraphContainer}>
55
+ <h1 className={classes.titleStyle}>Features</h1>
56
+ <div className={classes.infoSection}>
57
+ <p className={classes.paragraphStyle}>
58
+ <span className={classes.boldText}>React: </span>A JavaScript library for building user interfaces.
59
+ </p>
60
+ </div>
61
+ <div className={classes.infoSection}>
62
+ <p className={classes.paragraphStyle}>
63
+ <span className={classes.boldText}>TypeScript: </span>A superset of JavaScript that adds static typing.
64
+ </p>
65
+ </div>
66
+ <div className={classes.infoSection}>
67
+ <p className={classes.paragraphStyle}>
68
+ <span className={classes.boldText}>React Query: </span>A library for managing, caching, and updating server
69
+ state in React applications. (for more details check the{' '}
70
+ <span className={classes.highlight}>README.md</span> file under the{' '}
71
+ <span className={classes.boldText}>hooks</span> folder)
72
+ </p>
73
+ <div className={classes.demoStyle}>
74
+ <NavLink to={approutes.reactQueryDemo} className={classes.a}>
75
+ Run Demo
76
+ </NavLink>
77
+ </div>
78
+ </div>
79
+ <div className={classes.infoSection}>
80
+ <p className={classes.paragraphStyle}>
81
+ <span className={classes.boldText}>React Hook Form: </span>A library for managing forms with React hooks.
82
+ (for more details check the <span className={classes.highlight}>README.md</span> file under the{' '}
83
+ <span className={classes.boldText}>forms</span> folder)
84
+ </p>
85
+ <div className={classes.demoStyle}>
86
+ <NavLink to={approutes.reactHookFormDemo} className={classes.a}>
87
+ Run Demo
88
+ </NavLink>
89
+ </div>
90
+ </div>
91
+
92
+ <div className={classes.infoSection}>
93
+ <p className={classes.paragraphStyle}>
94
+ <span className={classes.boldText}>React Router: </span>A declarative routing solution for React. (for more
95
+ details check the <span className={classes.highlight}>README.md</span> file under the{' '}
96
+ <span className={classes.boldText}>routing</span> folder)
97
+ </p>
98
+ </div>
99
+ <div className={classes.infoSection}>
100
+ <p className={classes.paragraphStyle}>
101
+ <span className={classes.boldText}>...and more: </span>Explore the{' '}
102
+ <span className={classes.highlight}>Package.json</span> file to see additional dependencies.
103
+ </p>
104
+ </div>
105
+ </div>
106
+
107
+ <div className={classes.paragraphContainer}>
108
+ <h1 className={classes.titleStyle}>Project Structure</h1>
109
+
110
+ <div className={classes.infoSection}>
111
+ <div className={classes.tableWrapper}>
112
+ <table>
113
+ <thead>
114
+ <tr>
115
+ <th>Folder</th>
116
+ <th>Description</th>
117
+ </tr>
118
+ </thead>
119
+ <tbody>
120
+ <tr>
121
+ <td>
122
+ <span className={classes.boldText}>api</span>
123
+ </td>
124
+ <td>Place your API-related code here.</td>
125
+ </tr>
126
+ <tr>
127
+ <td>
128
+ <span className={classes.boldText}>assets</span>
129
+ </td>
130
+ <td>Store your static assets (images, fonts, etc.) in this directory.</td>
131
+ </tr>
132
+ <tr>
133
+ <td>
134
+ <span className={classes.boldText}>components</span>
135
+ </td>
136
+ <td>Reusable React components go here.</td>
137
+ </tr>
138
+ <tr>
139
+ <td>
140
+ <span className={classes.boldText}>config</span>
141
+ </td>
142
+ <td>Configuration files and environment variables are managed here.</td>
143
+ </tr>
144
+ <tr>
145
+ <td>
146
+ <span className={classes.boldText}>forms</span>
147
+ </td>
148
+ <td>Define your forms using React Hook Form.</td>
149
+ </tr>
150
+ <tr>
151
+ <td>
152
+ <span className={classes.boldText}>hooks</span>
153
+ </td>
154
+ <td>Custom React hooks to share logic across components.</td>
155
+ </tr>
156
+ <tr>
157
+ <td>
158
+ <span className={classes.boldText}>pages</span>
159
+ </td>
160
+ <td>React components that represent individual pages or views.</td>
161
+ </tr>
162
+ <tr>
163
+ <td>
164
+ <span className={classes.boldText}>providers</span>
165
+ </td>
166
+ <td>React context providers for state management.</td>
167
+ </tr>
168
+ <tr>
169
+ <td>
170
+ <span className={classes.boldText}>routing</span>
171
+ </td>
172
+ <td>Configure your application routes here.</td>
173
+ </tr>
174
+ <tr>
175
+ <td>
176
+ <span className={classes.boldText}>types</span>
177
+ </td>
178
+ <td>TypeScript type definitions.</td>
179
+ </tr>
180
+ <tr>
181
+ <td>
182
+ <span className={classes.boldText}>ui</span>
183
+ </td>
184
+ <td>Presentational components and styles.</td>
185
+ </tr>
186
+ <tr>
187
+ <td>
188
+ <span className={classes.boldText}>utils</span>
189
+ </td>
190
+ <td>General utility functions.</td>
191
+ </tr>
192
+ </tbody>
193
+ </table>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ <div className={classes.paragraphContainer}>
198
+ <h1 className={classes.titleStyle}>Additional Information</h1>
199
+ <div className={classes.infoSection}>
200
+ <ul>
201
+ <li>
202
+ - Customize the project configuration in the <code>config</code> directory.
203
+ </li>
204
+ <li>
205
+ - Explore the <code>utils</code> directory for utility functions.
206
+ </li>
207
+ <li>- Leverage React Query for efficient data fetching.</li>
208
+ <li>- Take advantage of React Hook Form for managing forms seamlessly.</li>
209
+ <li>
210
+ - Refer to the <code>types</code> directory for TypeScript type definitions.
211
+ </li>
212
+ </ul>
213
+ </div>
214
+ <div className={classes.infoSection}>
215
+ <span className={classes.centredText}>
216
+ <p className={classes.paragraphStyle}>
217
+ Our project is organized into various folders, each containing its own{' '}
218
+ <span className={classes.highlight}>README.md</span> file with specific details, instructions, and
219
+ additional information. This documentation will guide you through setting up the environment,
220
+ understanding the project structure, and using the available components and features. For more details,
221
+ check the <span className={classes.highlight}>README.md</span> file in{' '}
222
+ <span className={classes.boldText}>each folder of the project</span>.
223
+ </p>
224
+ </span>
225
+ </div>
226
+ <div className={classes.infoSection}>
227
+ <span className={classes.centredText}>
228
+ <p className={classes.paragraphStyle}>
229
+ Feel free to explore and modify the structure to suit your project's needs.{' '}
230
+ <span className={classes.boldText}>Happy coding!</span>
231
+ </p>
232
+ </span>
233
+ </div>
234
+ </div>
235
+ </div>
236
+ );
237
+ };
@@ -0,0 +1,32 @@
1
+ .container {
2
+ padding: 32px;
3
+ }
4
+
5
+ .fieldsetStyle {
6
+ margin-top: 24px;
7
+ }
8
+
9
+ .title {
10
+ padding-top: 16px;
11
+ font-size: 20px;
12
+ letter-spacing: 4px;
13
+ text-align: center;
14
+ color: #00008f;
15
+ }
16
+
17
+ .lineStyle {
18
+ width: 20%;
19
+ }
20
+
21
+ .paragraph {
22
+ padding-top: 16px;
23
+ }
24
+
25
+ .profileSectionStyle {
26
+ display: flex;
27
+ padding-top: 16px;
28
+ padding-bottom: 16px;
29
+ flex-flow: row wrap;
30
+ align-items: center;
31
+ justify-content: space-around;
32
+ }
@@ -0,0 +1,48 @@
1
+ import { ProfileForm } from '@Front/forms/ProfileForm';
2
+ import { ProfileType } from '@Front/types/profileTypes';
3
+ import { useState } from 'react';
4
+
5
+ import classes from './ReactHookFormDemo.module.css';
6
+
7
+ export const ReactHookFormDemo = () => {
8
+ const [profileData, setProfileData] = useState<ProfileType>();
9
+
10
+ const onSubmit = (data: ProfileType) => {
11
+ setProfileData({ ...data });
12
+ };
13
+
14
+ const resetForm = () => {
15
+ setProfileData(undefined);
16
+ };
17
+
18
+ return (
19
+ <div className={classes.container}>
20
+ <h1 className={classes.title}>React Hook Form</h1>
21
+ <hr className={classes.lineStyle} color="#00008f" />
22
+
23
+ <fieldset className={classes.fieldsetStyle}>
24
+ <legend className={classes.subTitle}>React Hook Form Example</legend>
25
+ <p className={classes.paragraph}>
26
+ React Hook Form is a React library that simplifies form management in a React application using hooks. It
27
+ provides a lightweight and efficient approach for handling form state, data validation, and handling
28
+ form-related events.
29
+ </p>
30
+ <div className={classes.profileSectionStyle}>
31
+ <fieldset>
32
+ <legend>Formulaire</legend>
33
+ <ProfileForm onSubmit={onSubmit} resetForm={resetForm} />
34
+ </fieldset>
35
+
36
+ {profileData && (
37
+ <fieldset>
38
+ <legend>Résultat</legend>
39
+ <p>E-mail: {profileData.mail} </p>
40
+ <p>First-name: {profileData.firstName} </p>
41
+ <p>Last-name: {profileData.lastName} </p>
42
+ </fieldset>
43
+ )}
44
+ </div>
45
+ </fieldset>
46
+ </div>
47
+ );
48
+ };
@@ -0,0 +1 @@
1
+ export { reactHookFormDemoRoutes } from './routes';
@@ -0,0 +1,7 @@
1
+ import { RouteObject } from 'react-router-dom';
2
+ import { ReactHookFormDemo } from './ReactHookFormDemo';
3
+
4
+ export const reactHookFormDemoRoutes: RouteObject = {
5
+ path: 'ReactHookFormDemo',
6
+ element: <ReactHookFormDemo />,
7
+ };
@@ -0,0 +1,38 @@
1
+ .container {
2
+ padding: 32px;
3
+ }
4
+
5
+ .fieldsetStyle {
6
+ margin-top: 24px;
7
+ padding: 16px;
8
+ border: 1px solid black;
9
+ }
10
+
11
+ .title {
12
+ padding-top: 16px;
13
+ font-size: 20px;
14
+ letter-spacing: 4px;
15
+ text-align: center;
16
+ color: #00008f;
17
+ }
18
+
19
+ .tableWrapper {
20
+ overflow: auto;
21
+ }
22
+
23
+ .dataTitle {
24
+ padding-top: 16px;
25
+ padding-bottom: 16px;
26
+ font-size: 20px;
27
+ letter-spacing: 4px;
28
+ text-align: center;
29
+ color: #00008f;
30
+ }
31
+
32
+ .lineStyle {
33
+ width: 20%;
34
+ }
35
+
36
+ .paragraph {
37
+ padding-top: 16px;
38
+ }