storybook/docs/snippets/angular/page-story-with-args-composition.ts.mdx
2021-02-02 00:50:49 +00:00

42 lines
1.2 KiB
Plaintext

```ts
// YourPage.stories.ts
import { moduleMetadata } from '@storybook/angular'
import { Story, Meta } from '@storybook/angular/types-6-0';
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';
import * as PageLayoutStories from './PageLayout.stories';
import * as DocumentHeaderStories from './DocumentHeader.stories';
import * as DocumentListStories from './DocumentList.stories';
export default {
component: DocumentScreen,
title: 'DocumentScreen',
decorators: [
moduleMetadata({
// imports components to allow component composition with Storybook
declarations: [DocumentList, DocumentHeader,PageLayout],
imports: [CommonModule],
}),
],
} as Meta;
const Template: Story<DocumentScreen> = (args) => ({
component: DocumentScreen,
props: args,
});
export const Simple = Template.bind({});
Simple.args = {
user: PageLayoutStories.PageLayoutSimple.args.user,
document: DocumentHeaderStories.DocumentHeaderSimple.args.document,
subdocuments: DocumentListStories.DocumentListSimple.args.documents
};
```