storybook/docs/snippets/angular/list-story-template.ts.mdx
2021-03-09 15:26:53 +00:00

31 lines
831 B
Plaintext

```ts
// List.stories.ts
import { Story } from '@storybook/angular/types-6-0';
import ListComponent from './List.component';
import ListItemComponent from './ListItem.component';
//👇 Imports a specific story from ListItem stories
import { Unchecked } from './ListItem.stories';
const ListTemplate: Story<ListComponent> = (args) => ({
moduleMetadata: {
declarations: [ListComponent, ListItemComponent],
},
props: args,
template: `
<list-component>
<div *ngFor="let item of items">
<listitem-component [item]="item"></listitem-component>
</div>
</list-component>`,
});
export const EmptyWithTemplate = ListTemplate.bind({});
Empty.args = { items: [] };
export const OneItemWithTemplate = ListTemplate.bind({});
OneItemWithTemplate.args = { items: [Unchecked.args.item] };
```