Skip to content

Commit 1f1cf65

Browse files
Youssef ELAMMARIMartinWeb
Youssef ELAMMARI
authored andcommitted
docs: update documentation and correction of misspelled words
1 parent c647a30 commit 1f1cf65

File tree

2 files changed

+108
-28
lines changed

2 files changed

+108
-28
lines changed

CONTRIBUTING.md

+29-27
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You must use a version of Node.js respecting the following rule `>=10.14.2` or `
1313

1414
## Installation
1515

16-
To get started, start by [forking the repository](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) on your personnal github account.
16+
To get started, start by [forking the repository](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) on your personal github account.
1717

1818
Then, clone the forked repository:
1919

@@ -50,7 +50,7 @@ npm run storybook
5050

5151
## Keeping your forked repository up-to-date
5252

53-
Before you start developping, it is important to always keep your forked repository **up-to-date**.
53+
Before you start developing, it is important to always keep your forked repository **up-to-date**.
5454

5555
### Link your forked repository to the original project
5656

@@ -81,10 +81,12 @@ Here's an example in JS:
8181
```text
8282
├── dist/ : contains the generated JS/CSS files (in the postinstall process).
8383
├── src/
84-
| ├── __snapshots__ : generated storybook snapshots used to test the component.
84+
| ├── __tests__
85+
| | ├── GreatComponent.spec.js : all unit tests for the component.
86+
| | ├── __snapshots__ : generated storybook snapshots used to test the component.
87+
| | | ├── GreatComponent.spec.js.snap
8588
| ├── GreatComponent.js : the react component code.
8689
| ├── GreatComponent.md : more documentation about the component (props, ...).
87-
| ├── GreatComponent.spec.js : all unit tests for the component.
8890
| ├── GreatComponent.stories.js : examples to be shown in the Storybook tool.
8991
| ├── great-component.scss : Sass file, complying to BEM convention
9092
| └── index.js : should export your component(s).
@@ -101,7 +103,7 @@ Into a terminal, to start to develop a component you can run
101103
npm run dev
102104
```
103105

104-
Or, if you want to run your component in watch mode, execting one of command below
106+
Or, if you want to run your component in watch mode, executing one of command below
105107

106108
```sh
107109
# If your component is in js
@@ -111,7 +113,7 @@ npm run dev:js -- --scope=@axa-fr/react-toolkit-action
111113
npm run dev:ts -- --scope=@axa-fr/react-toolkit-action
112114
```
113115

114-
_scope_ refer to package name of your component you are working on.
116+
_scope_ refers to package name of your component you are working on.
115117

116118
And then if you want to work on it, in isolation mode, you can run storybook
117119

@@ -151,7 +153,7 @@ npm test -- --coverage
151153

152154
You can find the list of supported browser in the [List of supported browsers](./README.md#list-of-supported-browsers) section of the README.
153155

154-
If you are developping on a Mac, you will find some Virtual Machines to help you test, on [Microsoft Edge Tools](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/) webiste.
156+
If you are developing on a Mac, you will find some Virtual Machines to help you test, on [Microsoft Edge Tools](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/) webiste.
155157

156158
### Documentation
157159

@@ -165,29 +167,29 @@ There, do not forget to update the component status page, please!
165167

166168
We are using the [Angular commit message format](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format), you are expected to follow it. This is very important because our changlog is generated using commit messages.
167169

168-
Keep in mind, though, that your pull request will be squashed into master, so repository mainteners may use your commit message but are not entitled to use them as is.
170+
Keep in mind, though, that your pull request will be squashed into master, so repository maintainers may use your commit message but are not entitled to use them as is.
169171

170172
## Scripts
171173

172-
| Script name | Description |
173-
| -------------------- | ----------------------------------------------------------------------------------------------------------- |
174-
| `publish` | Used by the CI to generate a new version. |
175-
| `postinstall` | Clean and build all compoents within the `packages` folder. It is ran just after the `npm install` command. |
176-
| `clean` | Removes all the generated `dist` folders and `node_modules` folders within the `packages`. |
177-
| `clean:dist` | Removes all the generated `dist` folders within the `packages` folder. |
178-
| `clean:node_modules` | Removes all the `node_modules` folders within the `packages` folder (uses `lerna clean`). |
179-
| `style` | Generates all `.css` file from the Sass `.scss` files. |
180-
| `storybook` | Lauches the [Storybook](#storybook) tool. |
181-
| `storybook:build` | Builds the [Storybook](#storybook) tool. |
182-
| `test` | Builds the [Design System](#design-system) tool. |
183-
| `cover` | Used by the CI to generate coverage files. |
184-
| `lint` | Launches both JS and TS linters |
185-
| `lint:js` | Launches JS linters, will fix whatever is possible to fix, for you. |
186-
| `lint:ts` | Launches TS linters, will fix whatever is possible to fix, for you. |
187-
| `dev` | Launches both JS and TS components in watch mode. |
188-
| `dev:js` | Launches JS components in watch mode. |
189-
| `dev:ts` | Launches TS components in watch mode. |
190-
| `changelog` | Used by the CI to generate the changelog using commit messages |
174+
| Script name | Description |
175+
| -------------------- | ------------------------------------------------------------------------------------------------------------ |
176+
| `publish` | Used by the CI to generate a new version. |
177+
| `postinstall` | Clean and build all components within the `packages` folder. It is ran just after the `npm install` command. |
178+
| `clean` | Removes all the generated `dist` folders and `node_modules` folders within the `packages`. |
179+
| `clean:dist` | Removes all the generated `dist` folders within the `packages` folder. |
180+
| `clean:node_modules` | Removes all the `node_modules` folders within the `packages` folder (uses `lerna clean`). |
181+
| `style` | Generates all `.css` file from the Sass `.scss` files. |
182+
| `storybook` | Launches the [Storybook](#storybook) tool. |
183+
| `storybook:build` | Builds the [Storybook](#storybook) tool. |
184+
| `test` | Builds the [Design System](#design-system) tool. |
185+
| `cover` | Used by the CI to generate coverage files. |
186+
| `lint` | Launches both JS and TS linters |
187+
| `lint:js` | Launches JS linters, will fix whatever is possible to fix, for you. |
188+
| `lint:ts` | Launches TS linters, will fix whatever is possible to fix, for you. |
189+
| `dev` | Launches both JS and TS components in watch mode. |
190+
| `dev:js` | Launches JS components in watch mode. |
191+
| `dev:ts` | Launches TS components in watch mode. |
192+
| `changelog` | Used by the CI to generate the changelog using commit messages |
191193

192194
## Troubleshooting
193195

MIGRATION.md

+79-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ className={getComponentClassName(...)}
3535

3636
## Imports
3737

38-
With the tree shaking and the separation between CommonJS and ECMAScript files, you should'n import the components from the component folder of the react-toolkit-all package.
38+
With the tree shaking and the separation between CommonJS and ECMAScript files, you shouldn't import the components from the component folder of the react-toolkit-all package.
3939

4040
Before :
4141

@@ -116,3 +116,81 @@ The component `Title` (from `@axa-fr/react-toolkit-layout-header`) has been rena
116116
- import { Title } from '@axa-fr/react-toolkit-all';
117117
+ import { HeaderTitle } from '@axa-fr/react-toolkit-all';
118118
```
119+
120+
## File Upload Data Handling
121+
122+
In 1.X
123+
124+
- Direct iteration over files and appending them to FormData.
125+
126+
```diff
127+
- const data = new FormData();
128+
- files.forEach(({ file, fieldname, referentialName, type }) => {
129+
- data.append('Files', file, cleanFileName(file.name));
130+
- data.append('FieldName', fieldname);
131+
- data.append('Referential', referentialName);
132+
- type && data.append('Type', type);
133+
-});
134+
```
135+
136+
In 2.0.x
137+
138+
- Asynchronous handling of files.
139+
- Files fetched as blobs.
140+
- Metadata such as field name and type appended to FormData.
141+
142+
```diff
143+
+ const data = new FormData();
144+
+ await Promise.all(
145+
+ files.map(async ({ file, fieldname, referentialName, type }) => {
146+
+ const blob = await fetch(file.preview).then((response) => response.blob());
147+
+ data.append('Files', blob, cleanFileName(file.name));
148+
+ data.append('FieldName', fieldname);
149+
+ data.append('Referential', referentialName);
150+
+ type && data.append('Type', type);
151+
+ })
152+
+);
153+
```
154+
155+
## CheckboxItem
156+
157+
There has been a change in the representation of boolean values in the events associated with checkbox state changes. In 1.x, boolean values were directly used in events, but after in 2.0.x, these values are now represented as strings indicating the boolean state.
158+
159+
Here is an exemple to adapt to this change :
160+
161+
```diff
162+
-export const handleChange = (e) => {
163+
- const newValue = !e.value;
164+
- // Rest of the logic
165+
-}
166+
167+
+export const handleChange = (e) => {
168+
+ const newValue = e.value === 'true';
169+
+ // Rest of the logic
170+
+}
171+
```
172+
173+
## Input Components
174+
175+
There has been a requirement change regarding the label attribute for all types of inputs. In the 1.x version, providing a label for the TextInput component was optional. However, in the 2.0.x version, a label is mandatory for all input components.
176+
177+
Here's an example demonstrating how to adapt to this change:
178+
179+
```diff
180+
- <TextInput
181+
- name="textInputName"
182+
- id="textInputId"
183+
- value="textInputValue"
184+
- onChange={e => handleChange(e)}
185+
- />
186+
187+
+ <TextInput
188+
+ name="textInputName"
189+
+ id="textInputId"
190+
+ value="textInputValue"
191+
+ onChange={e => handleChange(e)}
192+
+ label=""
193+
+ />
194+
```
195+
196+
In this example, the TextInput component previously didn't have a label specified, which now causes an issue. To resolve this, an empty label attribute has been added to comply with the new requirement.

0 commit comments

Comments
 (0)