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:
parent
62b7524e53
commit
900268ab27
@ -1,6 +1,9 @@
|
|||||||
const { configure } = require('@kadira/storybook');
|
const { configure } = require('@kadira/storybook');
|
||||||
|
|
||||||
|
const req = require.context('../src/components', true, /story.js$/)
|
||||||
|
|
||||||
function loadStories() {
|
function loadStories() {
|
||||||
|
req.keys().forEach((filename) => req(filename));
|
||||||
require('../stories');
|
require('../stories');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
ui/src/components/button/story.js
Normal file
27
ui/src/components/button/story.js
Normal 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>
|
||||||
|
));
|
@ -7,7 +7,7 @@ const {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
Base,
|
Base,
|
||||||
Button,
|
// Button,
|
||||||
Container,
|
Container,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Row,
|
Row,
|
||||||
@ -178,26 +178,26 @@ storiesOf('Avatar', module)
|
|||||||
</Base>
|
</Base>
|
||||||
));
|
));
|
||||||
|
|
||||||
storiesOf('Button', module)
|
// storiesOf('Button', module)
|
||||||
.add('With text', () => (
|
// .add('With text', () => (
|
||||||
<Button>
|
// <Button>
|
||||||
Inspire the lazy
|
// Inspire the lazy
|
||||||
</Button>
|
// </Button>
|
||||||
)).add('Secondary', () => (
|
// )).add('Secondary', () => (
|
||||||
<Button secondary>
|
// <Button secondary>
|
||||||
Inspire the brave
|
// Inspire the brave
|
||||||
</Button>
|
// </Button>
|
||||||
)).add('Disabled', () => (
|
// )).add('Disabled', () => (
|
||||||
<Button disabled>
|
// <Button disabled>
|
||||||
Inspire the liars
|
// Inspire the liars
|
||||||
</Button>
|
// </Button>
|
||||||
)).add('Anchor', () => (
|
// )).add('Anchor', () => (
|
||||||
<div>
|
// <div>
|
||||||
<Button href='#'>
|
// <Button href='#'>
|
||||||
Inspire the anchor
|
// Inspire the anchor
|
||||||
</Button>
|
// </Button>
|
||||||
</div>
|
// </div>
|
||||||
));
|
// ));
|
||||||
|
|
||||||
storiesOf('Checkbox', module)
|
storiesOf('Checkbox', module)
|
||||||
.add('Default', () => (
|
.add('Default', () => (
|
||||||
|
Loading…
Reference in New Issue
Block a user