DocSpace-client/web/ASC.Web.Storybook/stories/avatar/base/base.avatar.stories.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-06-18 13:20:49 +00:00
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs, boolean, text, select } from '@storybook/addon-knobs/react';
import withReadme from 'storybook-readme/with-readme';
import Readme from './README.md';
import { Avatar } from 'asc-web-components';
import Section from '../../../.storybook/decorators/section';
const roleOptions = ['owner', 'admin','guest','user'];
2019-06-27 11:28:13 +00:00
const sizeOptions = ['max', 'big', 'medium', 'small'];
2019-06-18 13:20:49 +00:00
storiesOf('Components|Avatar', module)
.addDecorator(withKnobs)
.addDecorator(withReadme(Readme))
2019-06-27 11:28:13 +00:00
.add('base', () => {
const size = select('size', sizeOptions, 'max');
2019-06-28 08:55:17 +00:00
const editing = size === 'max' ? boolean('editing', false) : false;
const editLabel = editing ? text('editLabel', 'Edit photo') : '';
2019-06-27 11:28:13 +00:00
return (
2019-06-18 13:20:49 +00:00
<Section>
<Avatar
2019-06-27 11:28:13 +00:00
size={size}
2019-06-18 13:20:49 +00:00
role={select('role', roleOptions, 'admin')}
source={text('source', '')}
2019-06-27 11:28:13 +00:00
userName={text('userName', '')}
editing={editing}
editLabel={editLabel}
editAction={() => console.log('Edit action')}
2019-06-18 13:20:49 +00:00
/>
</Section>
2019-06-27 11:28:13 +00:00
);
});