mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:21:57 +08:00
42 lines
710 B
Plaintext
42 lines
710 B
Plaintext
```js
|
|
// List.stories.js
|
|
|
|
import { html } from 'lit';
|
|
import { repeat } from 'lit/directives/repeat.js';
|
|
|
|
import { Unchecked } from './ListItem.stories';
|
|
|
|
export default {
|
|
title: 'List',
|
|
component: 'demo-list',
|
|
};
|
|
|
|
//👇 The ListTemplate construct will be spread to the existing stories.
|
|
const ListTemplate = {
|
|
render: ({ items, ...args }) => {
|
|
return html`
|
|
<demo-list>
|
|
${repeat(items, (item) => html`<demo-list-item>${item}</demo-list-item>`)}
|
|
</demo-list>
|
|
`;
|
|
},
|
|
};
|
|
export const Empty = {
|
|
...ListTemplate,
|
|
args: {
|
|
items: [],
|
|
},
|
|
};
|
|
|
|
export const OneItem = {
|
|
...ListTemplate,
|
|
args: {
|
|
items: [
|
|
{
|
|
...Unchecked.args,
|
|
},
|
|
],
|
|
},
|
|
};
|
|
```
|