Skip to content

Commit d5cf6cb

Browse files
committed
update button story
1 parent c7b8b7f commit d5cf6cb

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.storybook/preview.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ addParameters({
2222
: a[1].id.localeCompare(b[1].id, undefined, { numeric: true, caseFirst: 'upper' });
2323
},
2424
showRoots: true
25-
}
25+
},
26+
passArgsFirst: true,
27+
actions: { argTypesRegex: '^on.*' }
2628
});
2729

2830
const ThemeContainer = ({ theme, contentDensity, children, direction }) => {

packages/main/src/webComponents/Button/Button.stories.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
import { action } from '@storybook/addon-actions';
2-
import { boolean, select, text } from '@storybook/addon-knobs';
31
import { Button } from '@ui5/webcomponents-react/lib/Button';
42
import { ButtonDesign } from '@ui5/webcomponents-react/lib/ButtonDesign';
53
import React from 'react';
64

75
export default {
86
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+
}
1017
};
1118

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+
};
2426

2527
generatedDefaultStory.story = {
2628
name: 'Generated default story'

0 commit comments

Comments
 (0)