storybook/docs/snippets/html/list-story-reuse-data.js.mdx
2022-07-07 22:27:00 +01:00

33 lines
932 B
Plaintext

```js
// List.stories.js
import { createList } from './List';
import { createListItem } from './ListItem';
// 👇 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/html/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'List',
};
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/7.0/html/api/csf
* to learn how to use render functions.
*/
export const ManyItems = {
render: (args) => {
const list = createList(args);
list.appendChild(createListItem(Selected.args));
list.appendChild(createListItem(Unselected.args));
list.appendChild(createListItem(Unselected.args));
return list;
},
};
```