|
1 |
| -import { action } from '@storybook/addon-actions'; |
2 |
| -import { boolean, select, text } from '@storybook/addon-knobs'; |
3 | 1 | import { Button } from '@ui5/webcomponents-react/lib/Button';
|
4 | 2 | import { ButtonDesign } from '@ui5/webcomponents-react/lib/ButtonDesign';
|
5 | 3 | import React from 'react';
|
6 | 4 |
|
7 | 5 | export default {
|
8 | 6 | title: 'UI5 Web Components / Button',
|
9 |
| - component: Button |
| 7 | + component: Button, |
| 8 | + argTypes: { |
| 9 | + design: { |
| 10 | + defaultValue: ButtonDesign.Default, |
| 11 | + control: { type: 'options', controlType: 'select', options: ButtonDesign } |
| 12 | + }, |
| 13 | + icon: { defaultValue: 'add' }, |
| 14 | + children: { defaultValue: 'Button Text' }, |
| 15 | + onClick: { control: { type: 'function' } } |
| 16 | + } |
10 | 17 | };
|
11 | 18 |
|
12 |
| -export const generatedDefaultStory = () => ( |
13 |
| - <Button |
14 |
| - design={select('design', ButtonDesign, ButtonDesign.Default)} |
15 |
| - disabled={boolean('disabled', false)} |
16 |
| - icon={text('icon', 'add')} |
17 |
| - iconEnd={boolean('iconEnd', false)} |
18 |
| - submits={boolean('submits', false)} |
19 |
| - onClick={action('onClick')} |
20 |
| - > |
21 |
| - Some Content |
22 |
| - </Button> |
23 |
| -); |
| 19 | +export const generatedDefaultStory = ({ design, disabled, icon, iconEnd, submits, onClick, children }) => { |
| 20 | + return ( |
| 21 | + <Button design={design} disabled={disabled} icon={icon} iconEnd={iconEnd} submits={submits} onClick={onClick}> |
| 22 | + {children} |
| 23 | + </Button> |
| 24 | + ); |
| 25 | +}; |
24 | 26 |
|
25 | 27 | generatedDefaultStory.story = {
|
26 | 28 | name: 'Generated default story'
|
|
0 commit comments