Skip to content

Commit 86c4983

Browse files
sapeginmorgs32
authored andcommitted
Add React Styleguidist (facebook#2044)
1 parent 2b522f3 commit 86c4983

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ The [User Guide](https://github.com/facebookincubator/create-react-app/blob/mast
138138
- [Generating Dynamic `<meta>` Tags on the Server](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#generating-dynamic-meta-tags-on-the-server)
139139
- [Pre-Rendering into Static HTML Files](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#pre-rendering-into-static-html-files)
140140
- [Running Tests](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests)
141+
- [Developing Components in Isolation](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#developing-components-in-isolation)
141142
- [Making a Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)
142143
- [Deployment](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment)
143144
- [Advanced Configuration](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration)

packages/react-scripts/template/README.md

+42-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ You can find the most recent version of this guide [here](https://github.com/fac
6464
- [Disabling jsdom](#disabling-jsdom)
6565
- [Snapshot Testing](#snapshot-testing)
6666
- [Editor Integration](#editor-integration)
67+
- [Developing Components in Isolation](#developing-components-in-isolation)
68+
- [Getting Started with Storybook](#getting-started-with-storybook)
69+
- [Getting Started with Styleguidist](#getting-started-with-styleguidist)
6770
- [Making a Progressive Web App](#making-a-progressive-web-app)
6871
- [Offline-First Considerations](#offline-first-considerations)
6972
- [Progressive Web App Metadata](#progressive-web-app-metadata)
@@ -1431,14 +1434,15 @@ For an example, a simple button component could have following states:
14311434

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

1434-
Create React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/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**.
1437+
Create React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.
14351438

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

1438-
A storybook can also be deployed as a static app.
1439-
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.
1441+
You can also deploy your Storybook or style guide 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.
14401442

1441-
### Setup your app with Storybook
1443+
### Getting Started with Storybook
1444+
1445+
Storybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
14421446

14431447
First, install the following npm package globally:
14441448

@@ -1461,6 +1465,40 @@ Learn more about React Storybook:
14611465
* [Documentation](https://storybook.js.org/basics/introduction/)
14621466
* [Snapshot Testing UI](https://github.com/storybooks/storybook/tree/master/addons/storyshots) with Storybook + addon/storyshot
14631467

1468+
### Getting Started with Styleguidist
1469+
1470+
Styleguidist combines of a style guide, where all your components are presented on a single page with their props documentation and usage examples, with an environment for developing components in isolation, similar to Storybook. In Styleguidist you write examples in Markdown, where each code snippet is rendered as a live editable playground.
1471+
1472+
First install Styleguidist and peer dependencies from npm:
1473+
1474+
```sh
1475+
npm install --save-dev react-styleguidist webpack
1476+
```
1477+
1478+
Then, add these scripts to your `package.json`:
1479+
1480+
```sh
1481+
{
1482+
"scripts": {
1483+
"styleguide": "styleguidist server",
1484+
"styleguide:build": "styleguidist build"
1485+
}
1486+
}
1487+
```
1488+
1489+
Then, run the following command inside your app’s directory:
1490+
1491+
```sh
1492+
npm run styleguide
1493+
```
1494+
1495+
After that, follow the instructions on the screen.
1496+
1497+
Learn more about React Styleguidist:
1498+
1499+
* [GitHub Repo](https://github.com/styleguidist/react-styleguidist)
1500+
* [Documentation](https://react-styleguidist.js.org/docs/getting-started.html)
1501+
14641502
## Making a Progressive Web App
14651503

14661504
By default, the production build is a fully functional, offline-first

0 commit comments

Comments
 (0)