Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add information about React-styleguidist #921

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,16 @@ For an example, a simple button component could have following states:

Usually, it’s hard to see these states without running a sample app or some examples.

Create React App doesn't include any tools for this by default, but you can easily add [React Storybook](https://github.com/kadirahq/react-storybook) to your project. **It is a third-party tool that lets you develop components and see all their states in isolation from your app**.
Create React App doesn't include any tools for this by default, but there are some **third-party tools**, that that let you develop components and see all their states in isolation from your app:

* [React-storybook](https://github.com/kadirahq/react-storybook)
* [React-styleguidist](https://github.com/styleguidist/react-styleguidist)

### Getting started with Storybook

![React Storybook Demo](http://i.imgur.com/7CIAWpB.gif)

You can also deploy your Storybook as a static app. This way, everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app.
You can build your Storybook as a static app. This way, everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app.

**Here’s how to setup your app with Storybook:**

Expand All @@ -929,6 +934,26 @@ Learn more about React Storybook:
* [Documentation](https://getstorybook.io/docs)
* [Snapshot Testing](https://github.com/kadirahq/storyshots) with React Storybook

## Getting started with Styleguidist

[React-styleguidist](https://github.com/sapegin/react-styleguidist) is another tool that gives you an isolated sandbox, where you can develop your components independently. The difference between this and tool Storybook mentioned before is that Styleguidist automatically builds component index for you. It finds all React-components, understand PropTypes definition and creates a kind of documentation. You can extend this information by adding `Readme.md` file in the folder with your components. React-styleguidist will find all code snippets and will compile them, so you will get your examples alive. See [its documentation](https://github.com/sapegin/react-styleguidist/blob/master/docs/GettingStarted.md#documenting-components) to get more information.

To start using this with Create React App you need to install `react-app-styleguidist` – an integration of React-styleguidist into Create React App-based environment:

```
npm install react-app-styleguidist --save-dev
```

Then add `styleguide` into `scripts` section in your package.json

```
"styleguide": "styleguidist server ./src/App.js"
```

Then you can run `npm run styleguide` and see the initial version of the styleguide. Then you can modify your components, document additional prop types or add more examples, your code will be automatically rebuilt and webpage – reloaded.

In case, if you want to have more control on React-styleguidist and change some properties there, you can also perform the `eject` process, which is described [there](https://github.com/just-boris/react-app-styleguidist#ejecting). (This is only about React-styleguidist ejection, not the whole Create React App).

## Making a Progressive Web App

You can turn your React app into a [Progressive Web App](https://developers.google.com/web/progressive-web-apps/) by following the steps in [this repository](https://github.com/jeffposnick/create-react-pwa).
Expand Down