allowing component directories to contain there own stories for storybook. A component directory should now contain index.js, story.js and readme.md

This commit is contained in:
Alex Windett 2017-01-11 12:28:45 +00:00
parent 62b7524e53
commit 900268ab27
3 changed files with 52 additions and 22 deletions

View File

@ -1,7 +1,10 @@
const { configure } = require('@kadira/storybook');
const req = require.context('../src/components', true, /story.js$/)
function loadStories() {
req.keys().forEach((filename) => req(filename));
require('../stories');
}
configure(loadStories, module);
configure(loadStories, module);

View File

@ -0,0 +1,27 @@
const React = require('react');
const {
storiesOf
} = require('@kadira/storybook');
const Button = require('./');
storiesOf('Button', module)
.add('With text', () => (
<Button>
Inspire the lazy
</Button>
)).add('Secondary', () => (
<Button secondary>
Inspire the brave
</Button>
)).add('Disabled', () => (
<Button disabled>
Inspire the liars
</Button>
)).add('Anchor', () => (
<div>
<Button href='#'>
Inspire the anchor
</Button>
</div>
));

View File

@ -7,7 +7,7 @@ const {
const {
Base,
Button,
// Button,
Container,
Checkbox,
Row,
@ -178,26 +178,26 @@ storiesOf('Avatar', module)
</Base>
));
storiesOf('Button', module)
.add('With text', () => (
<Button>
Inspire the lazy
</Button>
)).add('Secondary', () => (
<Button secondary>
Inspire the brave
</Button>
)).add('Disabled', () => (
<Button disabled>
Inspire the liars
</Button>
)).add('Anchor', () => (
<div>
<Button href='#'>
Inspire the anchor
</Button>
</div>
));
// storiesOf('Button', module)
// .add('With text', () => (
// <Button>
// Inspire the lazy
// </Button>
// )).add('Secondary', () => (
// <Button secondary>
// Inspire the brave
// </Button>
// )).add('Disabled', () => (
// <Button disabled>
// Inspire the liars
// </Button>
// )).add('Anchor', () => (
// <div>
// <Button href='#'>
// Inspire the anchor
// </Button>
// </div>
// ));
storiesOf('Checkbox', module)
.add('Default', () => (