mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-02 05:03:44 +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,
|
component: Icon,
|
||||||
argTypes: {
|
argTypes: {
|
||||||
icon: {
|
icon: {
|
||||||
control: {
|
options: Object.keys(iconMap),
|
||||||
type: 'select',
|
|
||||||
options: Object.keys(iconMap),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as Meta;
|
} as Meta;
|
||||||
|
@ -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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -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 -->
|
||||||
```
|
```
|
||||||
|
@ -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']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -6,11 +6,9 @@
|
|||||||
component={Button}
|
component={Button}
|
||||||
argTypes={{
|
argTypes={{
|
||||||
variant: {
|
variant: {
|
||||||
control: {
|
options: ['primary', 'secondary'],
|
||||||
type: 'radio',
|
control: { type: 'radio' }
|
||||||
options: ['primary', 'secondary']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
@ -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',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
@ -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"/>',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -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),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user