Merge pull request #14999 from storybookjs/argtype-options-snippets

Update code snippets to use `argTypes[key].options` instead of `control.options`
This commit is contained in:
Michael Shilman 2021-05-21 22:23:23 +08:00 committed by GitHub
commit 3e16bf6ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 49 deletions

View File

@ -15,10 +15,7 @@ export default {
component: Icon, component: Icon,
argTypes: { argTypes: {
icon: { icon: {
control: { options: Object.keys(iconMap),
type: 'select',
options: Object.keys(iconMap),
},
}, },
}, },
} as Meta; } as Meta;

View File

@ -8,16 +8,13 @@ export default {
status: { status: {
name: 'Badge Status', name: 'Badge Status',
description: 'Available options available to the Badge', description: 'Available options available to the Badge',
control: { options: [
type: 'select', 'positive',
options: [ 'negative',
'positive', 'warning',
'negative', 'error',
'warning', 'neutral'
'error', ],
'neutral'
],
},
table: { table: {
defaultValue: { defaultValue: {
summary: 'positive' summary: 'positive'
@ -43,4 +40,4 @@ export default {
} }
} }
}; };
``` ```

View File

@ -11,16 +11,13 @@ import { Badge } from './Badge';
status: { status: {
name: 'Badge Status', name: 'Badge Status',
description: 'Available options available to the Badge', description: 'Available options available to the Badge',
control: { options: [
type: 'select', 'positive',
options: [ 'negative',
'positive', 'warning',
'negative', 'error',
'warning', 'neutral'
'error', ],
'neutral'
],
},
table: { table: {
defaultValue: { defaultValue: {
summary: 'positive' summary: 'positive'
@ -54,4 +51,4 @@ Let's define a story for our `Badge` component
<ArgsTable of={Badge} /> <ArgsTable of={Badge} />
<!-- remainder story implementation --> <!-- remainder story implementation -->
``` ```

View File

@ -6,11 +6,9 @@ export default {
component: Button, component: Button,
argTypes: { argTypes: {
variant: { variant: {
control: { options: ['primary', 'secondary'],
type: 'radio', control: { type: 'radio' }
options: ['primary', 'secondary']
}
} }
} }
}; };
``` ```

View File

@ -6,11 +6,9 @@
component={Button} component={Button}
argTypes={{ argTypes={{
variant: { variant: {
control: { options: ['primary', 'secondary'],
type: 'radio', control: { type: 'radio' }
options: ['primary', 'secondary']
}
} }
}} }}
/> />
``` ```

View File

@ -12,9 +12,7 @@
component={Table} component={Table}
argTypes={{ argTypes={{
size: { size: {
control: { options: ['small', 'medium', 'large'],
type: 'select',
options: ['small', 'medium', 'large'] },
}, },
}} }}
/> />
@ -44,4 +42,4 @@
size: 'large', size: 'large',
}} }}
/> />
``` ```

View File

@ -14,10 +14,7 @@ export default {
//👇 Creates specific argTypes with options //👇 Creates specific argTypes with options
argTypes: { argTypes: {
icon: { icon: {
control: { options: Object.keys(iconMap),
type: 'select',
options: Object.keys(iconMap),
},
}, },
}, },
}; };
@ -39,4 +36,4 @@ const Template = (args, { argTypes }) => {
template: '<YourComponent v-bind="$props"/>', template: '<YourComponent v-bind="$props"/>',
}; };
}; };
``` ```

View File

@ -14,10 +14,7 @@ export default {
//👇 Creates specific argTypes with options //👇 Creates specific argTypes with options
argTypes: { argTypes: {
icon: { icon: {
control: { options: Object.keys(iconMap),
type: 'select',
options: Object.keys(iconMap),
},
}, },
}, },
}; };