ArgsTable: revert tricky "story reuse" pattern

This commit is contained in:
Michael Shilman 2020-06-10 17:35:22 +08:00
parent 4aa74d2aee
commit 51e94df178
4 changed files with 17 additions and 35 deletions

View File

@ -51,11 +51,3 @@ Error.args = {
export const Empty = (args) => <ArgsTable {...args} />;
Empty.args = { rows: {} };
// For story-reuse, need a better way to do this
Normal.defaultProps = Normal.args;
Compact.defaultProps = Compact.args;
Sections.defaultProps = Sections.args;
SectionsCompact.defaultProps = SectionsCompact.args;
Error.defaultProps = Error.args;
Empty.defaultProps = Empty.args;

View File

@ -17,13 +17,8 @@ export const Text = (args) => {
Text.args = {
markdown: textCaption,
};
Text.defaultProps = Text.args;
export const Markdown = (args) => <Description {...args} />;
Markdown.args = {
markdown: markdownCaption,
};
// For story-reuse, need a better way to do this
Text.defaultProps = Text.args;
Markdown.defaultProps = Markdown.args;

View File

@ -1,10 +1,11 @@
import React from 'react';
import { Title, Subtitle, DocsPageWrapper } from './DocsPage';
import { ArgsTable, Source, Description } from './index';
import * as Story from './Story.stories';
import * as Preview from './Preview.stories';
import * as ArgsTable from './ArgsTable/ArgsTable.stories';
import * as Source from './Source.stories';
import * as Description from './Description.stories';
import * as argsTable from './ArgsTable/ArgsTable.stories';
import * as source from './Source.stories';
import * as description from './Description.stories';
export default {
title: 'Docs/DocsPage',
@ -19,18 +20,18 @@ export const WithSubtitle = () => (
<Subtitle>
What the DocsPage looks like. Meant to be QAed in Canvas tab not in Docs tab.
</Subtitle>
<Description.Text />
<Description {...description.Text.args} />
<Preview.Single />
<ArgsTable.Normal />
<Source.JSX />
<ArgsTable {...argsTable.Normal.args} />
<Source {...source.JSX.args} />
</DocsPageWrapper>
);
export const Empty = () => (
<DocsPageWrapper>
<Story.Error />
<ArgsTable.Error />
<Source.SourceUnavailable />
<ArgsTable {...argsTable.Error.args} />
<Source {...source.SourceUnavailable.args} />
</DocsPageWrapper>
);
@ -38,27 +39,27 @@ export const NoText = () => (
<DocsPageWrapper>
<Title>no text</Title>
<Preview.Single />
<ArgsTable.Normal />
<Source.JSX />
<ArgsTable {...argsTable.Normal.args} />
<Source {...source.JSX.args} />
</DocsPageWrapper>
);
export const Text = () => (
<DocsPageWrapper>
<Title>Sensorium</Title>
<Description.Text />
<Description {...description.Text.args} />
<Preview.Single />
<ArgsTable.Normal />
<Source.JSX />
<ArgsTable {...argsTable.Normal.args} />
<Source {...source.JSX.args} />
</DocsPageWrapper>
);
export const Markdown = () => (
<DocsPageWrapper>
<Title>markdown</Title>
<Description.Markdown />
<Description {...description.Markdown.args} />
<Preview.Single />
<ArgsTable.Normal />
<Source.JSX />
<ArgsTable {...argsTable.Normal.args} />
<Source {...source.JSX.args} />
</DocsPageWrapper>
);

View File

@ -51,9 +51,3 @@ SourceUnavailable.args = {
error: SourceError.SOURCE_UNAVAILABLE,
format: false,
};
// For story-reuse, need a better way to do this
JSX.defaultProps = JSX.args;
CSS.defaultProps = CSS.args;
NoStory.defaultProps = NoStory.args;
SourceUnavailable.defaultProps = SourceUnavailable.args;