You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Run `./setup.sh` in the root `dcx-react-library` folder
14
-
3. Run `yarn` within `./example` folder
15
14
16
-
Once this is done, you can modify any file locally and run `yarn start`,
17
-
`yarn test` or `yarn run build`.
18
-
19
-
If you want to test your component you can import the component into the
20
-
`./example` application once you have `yarn start` the `cdcx-react-library`
21
-
root project and run `yarn start` within the `./example` folder
15
+
this command will install all the dependencies and it will links the dcx-react-library to the example folder.
22
16
23
17
## Commands
24
18
25
-
DCX Component Library scaffolds your new library inside the `/src` folder and also sets up a [Parcel-based](https://parceljs.org) playground for it inside the `/example` folder.
19
+
DCX Component Library scaffolds your new library inside the `/src` folder and also sets up a [Create-React-App](https://reactjs.org/docs/create-a-new-react-app.html) playground for it inside the `/example` folder.
26
20
27
21
The recommended workflow is to run DCX Component Library in one terminal:
28
22
29
23
```bash
30
-
yarn install #to install dependencies
31
-
yarn start #to run the library
24
+
yarn dev #to run the library
32
25
```
33
26
34
27
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
@@ -53,29 +46,30 @@ Run the example inside another terminal:
53
46
54
47
```bash
55
48
cd example
56
-
yarn install #to install dependencies
57
49
yarn start #to run the examples
58
50
```
59
51
60
-
The default example imports and live reloads whatever is in the `/dist` folder, so if you are seeing an out of date component, make sure DCX Component Library is running in watch mode as recommended above.**No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
52
+
The default example imports and live reloads whatever is in the `/dist` folder, so if you are seeing an out of date component, make sure DCX Component Library is running in watch mode as recommended above.
61
53
62
-
- To do a one-off build, use `yarn build`;
54
+
- To do a one-off build, use `yarn build` at the root of your project;
63
55
64
-
- To run tests, use `yarn test`;
56
+
- To run tests, use `yarn test` at the root of your project;
65
57
66
-
- To check the code coverage use `yarn test: coverage;
58
+
- To check the code coverage use `yarn test: coverage at the root of your project;
67
59
68
-
- To fix all the linting errors use `yarn lint: fix`.
60
+
- To fix all the linting errors use `yarn lint: fix` at the root of your project.
69
61
70
62
## Submit your PR
71
63
72
64
To create a new component the following must be satisfied before adding
73
65
`READY TO MERGE` labels on PR:
74
66
75
-
1. create a branch called: feature/7-input (where 7 is the git issue number)
76
-
2. create a folder under `src` for the component-name
77
-
3. create the test under `__tests__` within the component-name folder
78
-
4. create a demo in the `example/src`
67
+
1. we usually have a base branch to branch from based on the release we currently are: release/x.x
68
+
2. create a branch called: feature/7-input (where 7 is the git issue number) from the base branch (release/x.x)
69
+
3. create a folder under `src` for the component-name
70
+
4. create the test under `__tests__` within the component-name folder
71
+
5. create or edit a demo in the `example/src`
72
+
6. create or edit the story in the `stories`
79
73
80
74
Example folder structure with component `SnackBar`:
81
75
@@ -137,6 +131,10 @@ We use circleCi for continuous integration. CircleCi configuration is stored und
137
131
138
132
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`.
139
133
134
+
## Documentation
135
+
136
+
All the stories created in Storybook are deployed in [Chromatic](main--6069a6f47f4b9f002171f8e1.chromatic.com). You can also see a preview of your PR before requesting a merge looking on the circle-ci pipline.
137
+
140
138
### Jest
141
139
142
140
Jest tests are set up to run with `yarn test`. PR with a coverage less than **100%** will not be merged.
Copy file name to clipboardExpand all lines: README.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,16 +12,14 @@ dcx-react-library is **UI/UX agnostic** so you need to provide styling to match
12
12
13
13
## Components
14
14
15
-
To see the full list of components built in dcx-react-library, and how to use it, have a look on our [storybook-showcase](https://www.chromatic.com/library?appId=6069a6f47f4b9f002171f8e1) (Click on View Storybook to see the list of components)
15
+
To see the full list of components built in dcx-react-library, and how to use it, have a look on our [storybook-showcase](https://main--6069a6f47f4b9f002171f8e1.chromatic.com)
16
16
In Storybook, each component is presented with 4 main sections:
17
17
18
18
-**documentation**: describes the list of properties available, optional and mandatory;
19
19
-**live**: you can play directly with all the properties and see the component's behaviour;
20
20
-**unstyled**: the bare component without any styling applied;
21
21
-**styled**: an example (mainly based on GDS) of how to style the component and the final result.
22
22
23
-

24
-
25
23
## How to use it
26
24
27
25
Using dcx-react-library should not require any particular setup. You only need to import the component and use it :smiley:
@@ -32,13 +30,22 @@ Steps:
32
30
- Import the component you need and use it. For example:
We don't ship `dcx-react-library` with any included CSS. However, some stylesheet is required to use some components (for example, `toggle` and `tooltip`).
43
+
44
+
```js
45
+
/* The following line can be included in your src/index.js or App.js file */
0 commit comments