Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Add react storybook - Closes #496 #497

Merged
merged 9 commits into from
Jul 24, 2017
Prev Previous commit
Next Next commit
Move stories to component folders
slaweet committed Jul 24, 2017

Unverified

The committer email address is not verified.
commit 48db196e04764a5b49226f7cb4953d0126e0fafc
4 changes: 3 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@ import { configure } from '@storybook/react';
import '../src/components/app/app.css';

function loadStories() {
require('../stories');
require('../src/components/account/stories');
require('../src/components/dialog/stories');
require('../src/components/formattedNumber/stories');
}

configure(loadStories, module);
27 changes: 2 additions & 25 deletions stories/index.js → src/components/account/stories.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import React from 'react';

import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
// import { linkTo } from '@storybook/addon-links';

import FormattedNumber from '../src/components/formattedNumber';
import Account from '../src/components/account/accountComponent';
import Address from '../src/components/account/address';
import Dialog from '../src/components/dialog/dialogElement';

storiesOf('FormattedNumber', module)
.add('with val', () => (
<FormattedNumber val="-3.1415926535" />
));
import Account from './accountComponent';
import Address from './address';

storiesOf('Account', module)
.add('delegate', () => (
@@ -52,16 +42,3 @@ storiesOf('Address', module)
address="9396639332432599292L"
/>
));

const dialogContent = () => (<div>Hello</div>);

storiesOf('Dialog', module)
.add('default', () => (
<Dialog
dialog={{
title: 'Title',
childComponent: dialogContent,
}}
onCancelClick={ action('onCancelClick') }
/>
));
18 changes: 18 additions & 0 deletions src/components/dialog/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Dialog from './dialogElement';

const dialogContent = () => (<div>Hello</div>);

storiesOf('Dialog', module)
.add('default', () => (
<Dialog
dialog={{
title: 'Title',
childComponent: dialogContent,
}}
onCancelClick={ action('onCancelClick') }
/>
));
10 changes: 10 additions & 0 deletions src/components/formattedNumber/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';

import { storiesOf } from '@storybook/react';

import FormattedNumber from './';

storiesOf('FormattedNumber', module)
.add('with val', () => (
<FormattedNumber val="-3.1415926535" />
));