storybook/docs/snippets/vue/list-story-reuse-data.2.js.mdx
2021-11-09 01:41:54 +00:00

34 lines
869 B
Plaintext

```js
// List.stories.js
import List from './ListComponent.vue';
import ListItem from './ListItem.vue';
//👇 We're importing the necessary stories from ListItem
import { Selected, Unselected } from './ListItem.stories';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'List',
component: List,
};
export const ManyItems = (args, { argTypes }) => ({
components: { List, ListItem },
props: Object.keys(argTypes),
template: `
<List v-bind="$props">
<list-item :isSelected="Selected"/>
<list-item :isSelected="Unselected"/>
<list-item :isSelected="Unselected"/>
</List>`,
});
ManyItems.args = {
Selected: Selected.args.isSelected,
Unselected: Unselected.args.isSelected,
};
```