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

Commit d084fc1

Browse files
Added sample storybook.
1 parent 40cb7af commit d084fc1

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

.storybook/addons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import '@kadira/storybook/addons'
2+
import '@kadira/storybook-addon-knobs/register'

.storybook/config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// IMPORTANT
2+
// ---------
3+
// This is an auto generated file with React CDK.
4+
// Do not modify this file.
5+
6+
import { configure } from '@kadira/storybook'
7+
8+
function loadStories () {
9+
require('../example/stories')
10+
}
11+
12+
configure(loadStories, module)

.storybook/webpack.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// IMPORTANT
2+
// ---------
3+
// This is an auto generated file with React CDK.
4+
// Do not modify this file.
5+
// Use `.storybook/user/modify_webpack_config.js instead`.
6+
7+
const path = require('path')
8+
9+
const config = {
10+
module: {
11+
loaders: [
12+
{
13+
test: /\.css?$/,
14+
loaders: ['style', 'raw'],
15+
include: path.resolve(__dirname, '../'),
16+
},
17+
],
18+
},
19+
}
20+
21+
module.exports = config

example/stories/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, { PropTypes } from 'react'
2+
import { storiesOf } from '@kadira/storybook'
3+
import { withKnobs } from '@kadira/storybook-addon-knobs'
4+
import { withSmartKnobs } from '../../src'
5+
6+
const Button = ({ children, onClick }) => (
7+
<button onClick={ onClick }>{ children }</button>
8+
)
9+
10+
Button.propTypes = {
11+
onClick: PropTypes.func,
12+
children: PropTypes.string,
13+
}
14+
15+
storiesOf('Example of Knobs', module)
16+
.addDecorator(withSmartKnobs)
17+
.addDecorator(withKnobs)
18+
.add('simple example', () => (
19+
<Button>My button</Button>
20+
))

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"test": "jest",
88
"clean": "rm -Rf ./dist",
99
"compile": "babel ./src --out-dir ./dist",
10+
"storybook": "start-storybook -p 9010",
1011
"prepublish": "npm run clean && npm run compile"
1112
},
1213
"author": "",
@@ -16,9 +17,14 @@
1617
"react": "^0.14.7 || ^15.0.0"
1718
},
1819
"devDependencies": {
20+
"@kadira/storybook": "^2.25.0",
21+
"@kadira/storybook-addon-knobs": "^1.3.0",
1922
"babel-cli": "^6.16.0",
2023
"babel-preset-es2015": "^6.16.0",
2124
"babel-preset-react": "^6.16.0",
22-
"babel-preset-stage-0": "^6.16.0"
25+
"babel-preset-stage-0": "^6.16.0",
26+
"eslint-config-taller": "^1.0.2",
27+
"react": "^0.14.7 || ^15.0.0",
28+
"react-dom": "^15.3.2"
2329
}
2430
}

0 commit comments

Comments
 (0)