storybook/docs/snippets/angular/page-story-with-args-composition.ts.mdx
2021-11-04 23:10:45 +00:00

44 lines
1.3 KiB
Plaintext

```ts
// YourPage.stories.ts
import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { CommonModule } from '@angular/common';
import { DocumentScreen } from './YourPage.component';
import { DocumentList } from './DocumentList.component';
import { DocumentHeader } from './DocumentHeader.component';
import { PageLayout } from './PageLayout.component';
//👇 Imports the required stories
import * as PageLayoutStories from './PageLayout.stories';
import * as DocumentHeaderStories from './DocumentHeader.stories';
import * as DocumentListStories from './DocumentList.stories';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'DocumentScreen',
component: DocumentScreen,
decorators: [
moduleMetadata({
declarations: [DocumentList, DocumentHeader, PageLayout],
imports: [CommonModule],
}),
],
} as Meta;
const Template: Story = (args) => ({
props: args,
});
export const Simple = Template.bind({});
Simple.args = {
user: PageLayoutStories.PageLayoutSimple.args.user,
document: DocumentHeaderStories.DocumentHeaderSimple.args.document,
subdocuments: DocumentListStories.DocumentListSimple.args.documents
};
```