Skip to content

Commit a507986

Browse files
committed
Merge 3dffccd from design-react-kit
1 parent 98ab126 commit a507986

File tree

11 files changed

+21151
-15913
lines changed

11 files changed

+21151
-15913
lines changed

Diff for: .gitignore

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# Dependencies
12
node_modules
2-
package-lock.json
3-
storybook-prod
3+
4+
# Outputs
5+
dist
6+
7+
# Logs
48
npm-debug.log
5-
.out
6-
lib

Diff for: .storybook/addons.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@storybook/addon-options/register";

Diff for: .storybook/config.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
import React from 'react';
2-
import {configure, addDecorator} from '@storybook/react';
3-
import '@storybook/addon-actions/register';
4-
import '@storybook/addon-console';
5-
import '../src/index.css';
6-
import './utils.css';
1+
import { configure } from "@storybook/react";
2+
import { setOptions } from "@storybook/addon-options";
73

8-
// Get all files inside `components` directory which ends with `.story.js`
9-
const req = require.context('../src', true, /\.story\.js$/);
4+
import "bootstrap-italia/dist/css/bootstrap-italia.min.css";
5+
import "bootstrap-italia/dist/css/italia-icon-font.css";
106

7+
// addon-options
8+
// https://github.com/storybooks/storybook/tree/master/addons/options
9+
setOptions({
10+
// name to display in the top left corner
11+
name: "design-react-kit",
12+
// URL for name in top left corner to link to
13+
url: "https://github.com/italia/design-react-kit/"
14+
});
15+
16+
// automatically import all files ending in *.stories.js
17+
const req = require.context("../stories", true, /.stories.js$/);
1118
function loadStories() {
12-
req.keys().forEach(filename => req(filename));
19+
req.keys().forEach(filename => req(filename));
1320
}
1421

15-
addDecorator(story => <div className="c-hideFocus">{story()}</div>);
1622
configure(loadStories, module);

Diff for: LICENSE

+6-499
Large diffs are not rendered by default.

Diff for: README.md

+26-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
21
[![Build Status](https://travis-ci.org/italia/design-react.svg?branch=master)](https://travis-ci.org/italia/design-react)
3-
[![Join the #design-js channel](https://img.shields.io/badge/Slack%20channel-%23design--js-blue.svg)](https://developersitalia.slack.com/messages/C7VPAUVB3/)
2+
[![Build Status](https://circleci.com/gh/italia/design-react.svg?branch=master)](https://circleci.com/gh/italia/design-react)
3+
[![Join the #design-devel channel](https://img.shields.io/badge/Slack%20channel-%23design--js-blue.svg)](https://developersitalia.slack.com/messages/C7VPAUVB3/)
44
[![Get invited](https://slack.developers.italia.it/badge.svg)](https://slack.developers.italia.it/)
55

66

77
# design-react
8-
A React toolkit that implements the Italia design system
8+
A React toolkit that implements `Bootstrap Italia`
99

1010
An easy-to-use showcase tool called Storybook is available to browse the library and view the components in action.
1111

@@ -20,32 +20,31 @@ An easy-to-use showcase tool called Storybook is available to browse the library
2020

2121
Just clone the repo and run `npm install` to install dependencies and `npm run storybook` to run the server.
2222

23-
The Storybook is then available at http://localhost:8010
23+
The Storybook is then available at http://localhost:6006
2424

2525
![storybook](/doc/storybook.png?raw=true)
2626

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).
2828

2929
## How to create a new component
3030

3131
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:
3434

3535
```
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
4042
```
4143

4244
Some basic rules to follow when structuring the component:
4345

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
4646
* 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.
4948

5049

5150
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
6564
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.
6665

6766
```sh
68-
$ npm run build-storybook
67+
$ npm run storybook:build
6968
```
7069

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.
7271

7372
#### known issues (open pull requests)
7473

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+
-
7775

7876
### Module
7977

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:
8179

8280
```sh
83-
$ npm install <package-name>
81+
$ npm install design-react
8482
```
8583

8684
Then start to use the components in your app:
8785

8886
```jsx
8987
import React from 'react';
90-
import {Button, Nav, Alert} from '<package-name>';
88+
import { Button, Nav, Alert } from 'design-react';
9189

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
91+
// import "bootstrap-italia/dist/css/bootstrap-italia.min.css";
92+
// import "bootstrap-italia/dist/css/italia-icon-font.css";
9493

9594
...
9695
```
9796

98-
You can find an example of this [in this repository](https://github.com/Roma-JS/design-react-demo).
9997
#### Preprocessors
10098

10199
If you're using preprocessors as SASS or Less you can import the CSS directly into your `main` file:
102100

103101
```scss
104-
@import '<package-name>/lib/index.css;
102+
@import "bootstrap-italia/src/scss/bootstrap-italia.scss";
105103
```
106104

107105
## Continuous Integration
108106

109-
There's a TravisCI instance configured to run on this repository every time the `master` branch is updated. Currently only the Storybook build is deployed to the `gh-pages` branch and it is publicly visible at `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

Comments
 (0)