mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-31 05:03:21 +08:00
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:
commit
3e16bf6ea8
@ -15,10 +15,7 @@ export default {
|
||||
component: Icon,
|
||||
argTypes: {
|
||||
icon: {
|
||||
control: {
|
||||
type: 'select',
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
},
|
||||
} as Meta;
|
||||
|
@ -8,16 +8,13 @@ export default {
|
||||
status: {
|
||||
name: 'Badge Status',
|
||||
description: 'Available options available to the Badge',
|
||||
control: {
|
||||
type: 'select',
|
||||
options: [
|
||||
'positive',
|
||||
'negative',
|
||||
'warning',
|
||||
'error',
|
||||
'neutral'
|
||||
],
|
||||
},
|
||||
options: [
|
||||
'positive',
|
||||
'negative',
|
||||
'warning',
|
||||
'error',
|
||||
'neutral'
|
||||
],
|
||||
table: {
|
||||
defaultValue: {
|
||||
summary: 'positive'
|
||||
@ -43,4 +40,4 @@ export default {
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
```
|
||||
|
@ -11,16 +11,13 @@ import { Badge } from './Badge';
|
||||
status: {
|
||||
name: 'Badge Status',
|
||||
description: 'Available options available to the Badge',
|
||||
control: {
|
||||
type: 'select',
|
||||
options: [
|
||||
'positive',
|
||||
'negative',
|
||||
'warning',
|
||||
'error',
|
||||
'neutral'
|
||||
],
|
||||
},
|
||||
options: [
|
||||
'positive',
|
||||
'negative',
|
||||
'warning',
|
||||
'error',
|
||||
'neutral'
|
||||
],
|
||||
table: {
|
||||
defaultValue: {
|
||||
summary: 'positive'
|
||||
@ -54,4 +51,4 @@ Let's define a story for our `Badge` component
|
||||
<ArgsTable of={Badge} />
|
||||
|
||||
<!-- remainder story implementation -->
|
||||
```
|
||||
```
|
||||
|
@ -6,11 +6,9 @@ export default {
|
||||
component: Button,
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: {
|
||||
type: 'radio',
|
||||
options: ['primary', 'secondary']
|
||||
}
|
||||
options: ['primary', 'secondary'],
|
||||
control: { type: 'radio' }
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
```
|
||||
|
@ -6,11 +6,9 @@
|
||||
component={Button}
|
||||
argTypes={{
|
||||
variant: {
|
||||
control: {
|
||||
type: 'radio',
|
||||
options: ['primary', 'secondary']
|
||||
}
|
||||
options: ['primary', 'secondary'],
|
||||
control: { type: 'radio' }
|
||||
}
|
||||
}}
|
||||
/>
|
||||
```
|
||||
```
|
||||
|
@ -12,9 +12,7 @@
|
||||
component={Table}
|
||||
argTypes={{
|
||||
size: {
|
||||
control: {
|
||||
type: 'select',
|
||||
options: ['small', 'medium', 'large'] },
|
||||
options: ['small', 'medium', 'large'],
|
||||
},
|
||||
}}
|
||||
/>
|
||||
@ -44,4 +42,4 @@
|
||||
size: 'large',
|
||||
}}
|
||||
/>
|
||||
```
|
||||
```
|
||||
|
@ -14,10 +14,7 @@ export default {
|
||||
//👇 Creates specific argTypes with options
|
||||
argTypes: {
|
||||
icon: {
|
||||
control: {
|
||||
type: 'select',
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -39,4 +36,4 @@ const Template = (args, { argTypes }) => {
|
||||
template: '<YourComponent v-bind="$props"/>',
|
||||
};
|
||||
};
|
||||
```
|
||||
```
|
||||
|
@ -14,10 +14,7 @@ export default {
|
||||
//👇 Creates specific argTypes with options
|
||||
argTypes: {
|
||||
icon: {
|
||||
control: {
|
||||
type: 'select',
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
options: Object.keys(iconMap),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user