Skip to content

Commit

Permalink
Add storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
nhim175 committed Dec 2, 2018
1 parent fde9a24 commit 9be6f0c
Show file tree
Hide file tree
Showing 5 changed files with 1,502 additions and 49 deletions.
11 changes: 11 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { configure, addDecorator } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';

addDecorator(withInfo);

function loadStories() {
require('../stories/index.js');
// You can require as many stories as you need.
}

configure(loadStories, module);
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
Expand All @@ -11,7 +12,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9001 -c .storybook"
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -21,5 +23,11 @@
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"devDependencies": {
"@storybook/addon-info": "^4.0.10",
"@storybook/react": "^4.0.10",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.4"
}
}
17 changes: 17 additions & 0 deletions stories/WeeklySongListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import WeeklySongListItem from '../src/components/WeeklySongListItem';

storiesOf('WeeklySongListItem', module)
.add(
'default',
() => (
<WeeklySongListItem
order="01"
title="Em Không Thể"
singer="Tiên Tiên, Touliver"
viewCount={3000}
/>
)
);
1 change: 1 addition & 0 deletions stories/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './WeeklySongListItem';
Loading

0 comments on commit 9be6f0c

Please sign in to comment.