Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
Add storybook
Browse files Browse the repository at this point in the history
storybookjs/storybook#5183
Explicitly set the version of babel-loader to 8.0.4
  • Loading branch information
zxzl committed Jan 27, 2019
1 parent a821322 commit cf59f7b
Show file tree
Hide file tree
Showing 6 changed files with 1,993 additions and 81 deletions.
19 changes: 0 additions & 19 deletions .babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
7 changes: 7 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { configure } from '@storybook/react';

function loadStories() {
require('../src/stories');
}

configure(loadStories, module);
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"devDependencies": {
"cypress": "^3.1.4",
"eslint-config-prettier": "^3.6.0",
"serve": "^10.1.1"
"serve": "^10.1.1",
"@storybook/react": "^4.1.11",
"@storybook/addon-actions": "^4.1.11",
"@storybook/addon-links": "^4.1.11",
"@storybook/addons": "^4.1.11",
"@babel/core": "^7.2.2",
"babel-loader": "8.0.4"
},
"dependencies": {
"color": "^2.0.0",
Expand Down Expand Up @@ -42,7 +48,9 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
},
"browserslist": [
">0.2%",
Expand Down
19 changes: 19 additions & 0 deletions src/stories/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';

import { Button, Welcome } from '@storybook/react/demo';

storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);

storiesOf('Button', module)
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)
.add('with some emoji', () => (
<Button onClick={action('clicked')}>
<span role="img" aria-label="so cool">
😀 😎 👍 💯
</span>
</Button>
));
Loading

0 comments on commit cf59f7b

Please sign in to comment.