forked from fedi/mastodon
Merge branch 'kschaper-react-storybook'
This commit is contained in:
commit
e2ff39bf5d
|
@ -3,3 +3,4 @@
|
|||
public/system
|
||||
public/assets
|
||||
node_modules
|
||||
storybook
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
"name": "mastodon",
|
||||
"scripts": {
|
||||
"test": "mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/*.test.jsx"
|
||||
"test": "mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/*.test.jsx",
|
||||
"storybook": "start-storybook -p 9001 -c storybook"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kadira/storybook": "^2.24.0",
|
||||
"axios": "^0.14.0",
|
||||
"babel-plugin-react-transform": "^2.0.2",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
||||
|
|
16
storybook/config.js
Normal file
16
storybook/config.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { configure } from '@kadira/storybook';
|
||||
import React from 'react';
|
||||
import { storiesOf, action } from '@kadira/storybook';
|
||||
|
||||
import './storybook.css'
|
||||
|
||||
window.storiesOf = storiesOf;
|
||||
window.action = action;
|
||||
window.React = React;
|
||||
|
||||
function loadStories () {
|
||||
require('./stories/loading_indicator.story.jsx');
|
||||
require('./stories/button.story.jsx');
|
||||
}
|
||||
|
||||
configure(loadStories, module);
|
15
storybook/stories/button.story.jsx
Normal file
15
storybook/stories/button.story.jsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
import Button from '../../app/assets/javascripts/components/components/button.jsx'
|
||||
|
||||
storiesOf('Button', module)
|
||||
.add('default state', () => (
|
||||
<Button text="submit" onClick={action('clicked')} />
|
||||
))
|
||||
.add('secondary', () => (
|
||||
<Button secondary text="submit" onClick={action('clicked')} />
|
||||
))
|
||||
.add('disabled', () => (
|
||||
<Button disabled text="submit" onClick={action('clicked')} />
|
||||
))
|
||||
.add('block', () => (
|
||||
<Button block text="submit" onClick={action('clicked')} />
|
||||
));
|
6
storybook/stories/loading_indicator.story.jsx
Normal file
6
storybook/stories/loading_indicator.story.jsx
Normal file
|
@ -0,0 +1,6 @@
|
|||
import LoadingIndicator from '../../app/assets/javascripts/components/components/loading_indicator.jsx'
|
||||
|
||||
storiesOf('LoadingIndicator', module)
|
||||
.add('default state', () => (
|
||||
<LoadingIndicator />
|
||||
));
|
3
storybook/storybook.css
Normal file
3
storybook/storybook.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
#root {
|
||||
padding: 4rem;
|
||||
}
|
Loading…
Reference in a new issue