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,
argTypes: {
icon: {
control: {
type: 'select',
options: Object.keys(iconMap),
},
options: Object.keys(iconMap),
},
},
} as Meta;

View File

@ -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 {
}
}
};
```
```

View File

@ -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 -->
```
```

View File

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

View File

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

View File

@ -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',
}}
/>
```
```

View File

@ -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"/>',
};
};
```
```

View File

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