joyent-portal/ui/stories/index.js

285 lines
5.5 KiB
JavaScript
Raw Normal View History

const React = require('react');
const {
storiesOf,
2016-12-08 19:29:04 +02:00
// action,
// linkTo
} = require('@kadira/storybook');
const {
Base,
2016-12-08 14:41:37 +02:00
Button,
Container,
2016-12-08 14:41:37 +02:00
Checkbox,
Row,
Column,
2016-12-09 12:40:57 +02:00
Avatar,
Input,
Modal,
Notificaton,
2016-12-09 19:43:26 +02:00
Pagination,
2016-12-09 19:15:08 +02:00
RangeSlider,
2016-12-09 17:34:10 +02:00
Select,
2016-12-09 16:57:23 +02:00
Tabs,
Tab,
2016-12-09 13:24:22 +02:00
Toggle,
2016-12-09 17:09:54 +02:00
Widget,
Radio,
RadioGroup
} = require('../src/');
const styles = {
base: {
backgroundColor: '#FFEBEE'
},
row: {
backgroundColor: '#EF5350'
},
column: {
backgroundColor: '#B71C1C',
textAlign: 'center',
color: 'white'
}
};
storiesOf('Grid', module)
.add('Row and Column', () => (
<Base>
<Container fluid>
<Row>
<Column
md={10}
sm={9}
style={styles.base}
xs={12}
>
<Row around style={styles.row}>
<Column
lg={4}
md={3}
sm={2}
style={styles.column}
xs={1}
>1</Column>
<Column
lg={4}
md={3}
sm={2}
style={styles.column}
xs={1}
>2</Column>
<Column
lg={4}
md={3}
sm={2}
style={styles.column}
xs={1}
>3</Column>
</Row>
</Column>
</Row>
</Container>
</Base>
));
2016-12-08 19:29:04 +02:00
const profile =
'https://pbs.twimg.com/profile_images/' +
'641289584580493312/VBfsPlff_400x400.jpg';
storiesOf('Avatar', module)
.add('Avatar Picture', () => (
<Avatar
color='#ef6176'
name='Tom'
2016-12-08 19:29:04 +02:00
src={profile}
/>
))
.add('Avatar Text', () => (
<Base>
<Avatar
color='#35a8c0'
name='Alex'
/>
<Avatar
color='#35a8c0'
name='Thomas'
/>
<Avatar
color='#35a8c0'
name='귀여운 오리'
/>
</Base>
));
2016-12-08 14:41:37 +02:00
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>
));
storiesOf('Checkbox', module)
.add('Default', () => (
2016-12-08 17:39:16 +02:00
<Checkbox />
2016-12-08 14:41:37 +02:00
))
.add('Checked', () => (
2016-12-08 17:39:16 +02:00
<Checkbox checked onChange={function noop() {}} />
2016-12-08 14:41:37 +02:00
))
.add('Disabled', () => (
2016-12-08 17:39:16 +02:00
<Checkbox disabled />
2016-12-08 14:41:37 +02:00
));
2016-12-09 12:40:57 +02:00
2016-12-09 17:26:11 +02:00
storiesOf('Radio', module)
.add('Default', () => (
<Radio>
Video killed the radio star
</Radio>
))
.add('Checked', () => (
<Radio checked onChange={function noop() {}} />
))
.add('Disabled', () => (
<Radio disabled />
));
storiesOf('Input', module)
.add('Default', () => (
2016-12-12 18:55:52 +02:00
<Input placeholder="I am the placeholder" />
))
.add('type=email', () => (
<Input
label='Email Address'
2016-12-12 01:54:53 +02:00
placeholder='Enter email'
type='email'
>
2016-12-12 01:54:53 +02:00
<small>We&apos;ll never share your email with anyone else.</small>
</Input>
));
storiesOf('Modal', module)
.add('Default', () => (
<Modal>
<h2>This is the Modal</h2>
</Modal>
));
storiesOf('Notificaton', module)
.add('Default', () => (
<Notificaton>
<span>This is the default content</span>
</Notificaton>
))
.add('warning', () => (
<Notificaton type='warning'>
<span>This is the warning content</span>
</Notificaton>
))
.add('alert', () => (
<Notificaton type='alert'>
<span>This is the alert content</span>
</Notificaton>
));
2016-12-09 19:43:26 +02:00
storiesOf('Pagination', module)
.add('Default', () => (
<Pagination>
<a>
<span>&laquo;</span>
<span>Previous</span>
</a>
<a>1</a>
<a active>2</a>
<a>3</a>
</Pagination>
));
storiesOf('Radio Group', module)
.add('Default', () => (
<RadioGroup>
<Radio value='default'>
Video killed the radio star
</Radio>
<Radio value='fancy'>
Video killed the radio star
</Radio>
<Radio value='none'>
Video killed the radio star
</Radio>
</RadioGroup>
2016-12-12 01:54:53 +02:00
));
2016-12-09 19:15:08 +02:00
storiesOf('RangeSlider', module)
.add('Default', () => (
<RangeSlider />
));
2016-12-09 17:34:10 +02:00
storiesOf('Select', module)
.add('Default', () => (
<Select label='example select'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</Select>
))
.add('multiple', () => (
<Select label='example multiple select' multiple>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</Select>
));
2016-12-09 16:57:23 +02:00
storiesOf('Tabs', module)
.add('Default', () => (
<Tabs name='my-tab-group'>
<Tab title='Containers'>
<h1>Containers</h1>
</Tab>
<Tab title='Users'>
<h1>User</h1>
</Tab>
</Tabs>
2016-12-09 17:34:10 +02:00
));
2016-12-09 16:57:23 +02:00
2016-12-09 13:24:22 +02:00
storiesOf('Toggle', module)
.add('checked', () => (
<Toggle checked />
))
.add('unchecked', () => (
<Toggle checked={false} />
))
.add('defaultChecked', () => (
<Toggle defaultChecked />
))
.add('no props', () => (
<Toggle />
2016-12-09 17:34:10 +02:00
));
2016-12-09 13:24:22 +02:00
2016-12-09 12:40:57 +02:00
storiesOf('Widget', module)
.add('single', () => (
2016-12-09 17:34:10 +02:00
<Widget
checked
name='flag'
selectable='single'
value='flag_1'
>
<img
alt='england flag'
// eslint-disable-next-line max-len
src='https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Union_flag_1606_(Kings_Colors).svg/2000px-Union_flag_1606_(Kings_Colors).svg.png'
/>
2016-12-09 12:40:57 +02:00
<p>Some text</p>
</Widget>
2016-12-09 17:34:10 +02:00
));