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
[](https://developersitalia.slack.com/messages/C7VPAUVB3/)
[](https://developersitalia.slack.com/messages/C7VPAUVB3/)
A React toolkit that implements the Italia design system
8
+
A React toolkit that implements `Bootstrap Italia`
9
9
10
10
An easy-to-use showcase tool called Storybook is available to browse the library and view the components in action.
11
11
@@ -20,32 +20,31 @@ An easy-to-use showcase tool called Storybook is available to browse the library
20
20
21
21
Just clone the repo and run `npm install` to install dependencies and `npm run storybook` to run the server.
22
22
23
-
The Storybook is then available at http://localhost:8010
23
+
The Storybook is then available at http://localhost:6006
24
24
25
25

26
26
27
-
A public version of Storybook is available [here](https://roma-js.github.io/design-react).
27
+
A public version of Storybook is available [here](https://italia.github.io/design-react).
28
28
29
29
## How to create a new component
30
30
31
31
This section will guide you to the creation of a new component in the repository.
32
-
All the components live in the components folder: each component has its own folder with all the content it needs to work, the test files and the storybook story to publish.
33
-
As example the Button component lives in the components/Button folder and structure is the following:
32
+
All the components live in the `components` folder: each component has its own folder with all the content it needs to work, the test files and the storybook story to publish.
33
+
As example the `Button` component lives in the `src/components/Button` folder and structure is the following:
34
34
35
35
```
36
-
components
37
-
└── Button
38
-
├── Button.js
39
-
└── Button.story.js
36
+
37
+
src
38
+
└── components
39
+
└── Button
40
+
├── Button.js
41
+
└── Button.stories.js
40
42
```
41
43
42
44
Some basic rules to follow when structuring the component:
43
45
44
-
* The components use a static CSS file imported in the main root.
45
-
* The CSS file comes from the `design-web-toolkit` repository and it has been built from there
46
46
* The JS file for the component uses the JSX syntax.
47
-
* Some components use some jQuery plugins.
48
-
* The .story.js file should only contains content related to that component.
47
+
* The `.stories.js` file should only contains content related to that component.
49
48
50
49
51
50
Once created a new component and started Storybook check that the new component has been added properly and it renders as it should.
@@ -65,46 +64,45 @@ In the component page it is also possible to access directly to the source code
65
64
There's a command to build a static version of the Storybook catalog so that it can be deployed anywere without any need of a webserver.
66
65
67
66
```sh
68
-
$ npm run build-storybook
67
+
$ npm run storybook:build
69
68
```
70
69
71
-
The static pages of the building process are stored in the `out` folder.
70
+
The static pages of the building process are stored in the `storybook-static` folder.
72
71
73
72
#### known issues (open pull requests)
74
73
75
-
-[Show JSX if PropVal is a React element](https://github.com/storybooks/storybook/pull/1455)
76
-
-[Fixed prop type validation errors in info addon](https://github.com/storybooks/storybook/pull/1374)
74
+
-
77
75
78
76
### Module
79
77
80
-
To use the React UIKit as module in the app you can install it directly from npm:
78
+
To use the React Design Kit as module in the app you can install it directly from npm:
81
79
82
80
```sh
83
-
$ npm install <package-name>
81
+
$ npm install design-react
84
82
```
85
83
86
84
Then start to use the components in your app:
87
85
88
86
```jsx
89
87
importReactfrom'react';
90
-
import {Button, Nav, Alert} from'<package-name>';
88
+
import {Button, Nav, Alert} from'design-react';
91
89
92
-
// If you want to handle the css with webpack uncomment this line
93
-
// import '<package-name>/lib/index.css';
90
+
// If you want to handle the CSS with your bundler uncomment this line
There'saTravisCIinstanceconfiguredtorunonthisrepositoryeverytimethe `master` branchisupdated. CurrentlyonlytheStorybookbuildisdeployedtothe `gh-pages` branchanditispubliclyvisibleat `https://<user>.github.io/design-react` - you need to configure Travis for your repo.
110
-
107
+
There's a CircleCI instance configured to run on this repository every time the `master` branch is updated.
108
+
Currently only the Storybook build is deployed to the `gh-pages` branch and it is publicly visible at `https://italia.github.io/design-react`.
0 commit comments