1
1
import {ArgsTable , Source , Story , Canvas , Meta } from ' @storybook/addon-docs' ;
2
2
import {useArgs } from ' @storybook/client-api' ;
3
3
import dedent from ' ts-dedent' ;
4
- import StoryConfig from ' ../../../.storybook/story-config.ts' ;
5
4
import Select from ' ./Select.tsx' ;
6
- import MenuItem from ' ../MenuItem ' ;
5
+ import StoryConfig from ' ../../../.storybook/story-config.ts ' ;
7
6
import FormControl from ' ../FormControl/FormControl.tsx' ;
7
+ import MenuItem from ' ../MenuItem/MenuItem.tsx' ;
8
+ import Stack from ' ../Stack/Stack.tsx' ;
8
9
9
10
export const meta = {
10
11
component: Select ,
@@ -14,18 +15,34 @@ export const meta = {
14
15
<Meta title = { meta .title } component = { meta .component } />
15
16
16
17
export const Template = args => {
17
- const [{open, anchor, onChange, label }, updateArgs] = useArgs ();
18
+ const [{anchor}, updateArgs] = useArgs ();
18
19
return (
19
- <FormControl fullWidth margin = " dense" >
20
- <Select label = " Select WSO2 Product" defaultValue = ' Asgardeo' onChange = { () => updateArgs ({value: anchor })} { ... args } >
21
- { [' Asgardeo' , ' Identity Server' , ' Choreo' , ' APIM' ].map (anchor => (
22
- <MenuItem key = { anchor } value = { anchor } >
23
- { anchor }
24
- </MenuItem >
25
- ))}
26
- </Select >
27
- </FormControl >
28
- )
20
+ <Stack gap = { 2 } >
21
+ <FormControl fullWidth variant = " standard" >
22
+ <Select
23
+ label = " Select WSO2 Product"
24
+ defaultValue = " Asgardeo"
25
+ onChange = { () => updateArgs ({value: anchor })}
26
+ { ... args }
27
+ >
28
+ { [' Asgardeo' , ' Identity Server' , ' Choreo' , ' APIM' ].map (_anchor => (
29
+ <MenuItem key = { _anchor } value = { _anchor } >
30
+ { _anchor }
31
+ </MenuItem >
32
+ ))}
33
+ </Select >
34
+ </FormControl >
35
+ <FormControl fullWidth variant = " standard" >
36
+ <Select label = " Select Version" defaultValue = " v0.1.0" onChange = { () => updateArgs ({value: anchor })} { ... args } >
37
+ { [' v0.1.0' , ' v1.0.0' , ' v2.0.0' ].map (_anchor => (
38
+ <MenuItem key = { _anchor } value = { _anchor } >
39
+ { _anchor }
40
+ </MenuItem >
41
+ ))}
42
+ </Select >
43
+ </FormControl >
44
+ </Stack >
45
+ );
29
46
};
30
47
31
48
# Select
@@ -39,11 +56,7 @@ export const Template = args => {
39
56
The ` Select ` component is used to create a select input.
40
57
41
58
<Canvas >
42
- <Story
43
- name = " Overview"
44
- >
45
- { Template .bind ({})}
46
- </Story >
59
+ <Story name = " Overview" >{ Template .bind ({})} </Story >
47
60
</Canvas >
48
61
49
62
## Props
0 commit comments