Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD stories for layout in mdx as example and regression test #9940

Merged
merged 4 commits into from
Feb 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions examples/official-storybook/stories/core/layout.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Button } from '@storybook/react/demo';

export default {
ndelangen marked this conversation as resolved.
Show resolved Hide resolved
title: 'Core/Layout MDX',
};

export const Default = () => <Box>padded by default</Box>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these functions need to be in a CSF file @ndelangen

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted all those exports, they aren't needed.


export const PaddedBlock = () => <Box>padded</Box>;
PaddedBlock.story = { parameters: { layout: 'padded' } };

export const PaddedInline = () => <Box display="inline-block">padded</Box>;
PaddedInline.story = { parameters: { layout: 'padded' } };

export const FullscreenBlock = () => <Box>fullscreen</Box>;
FullscreenBlock.story = { parameters: { layout: 'fullscreen' } };

export const FullscreenInline = () => <Box display="inline-block">fullscreen</Box>;
FullscreenInline.story = { parameters: { layout: 'fullscreen' } };

export const CenteredBlock = () => <Box>centered</Box>;
CenteredBlock.story = { parameters: { layout: 'centered' } };

export const CenteredInline = () => <Box display="inline-block">centered</Box>;
CenteredInline.story = { parameters: { layout: 'centered' } };

export const Invalid = () => <Box>invalid layout value</Box>;
CenteredInline.story = { parameters: { layout: '!invalid!' } };

<Meta
title="Core/Layout MDX"
component={Button}
id="core-layout-mdx"
decorators={[storyFn => <div style={{ backgroundColor: 'yellow' }}>{storyFn()}</div>]}
parameters={{ notes: 'component notes' }}
ndelangen marked this conversation as resolved.
Show resolved Hide resolved
/>

# Selected

<Preview>
<Story name="defaultValue">
<Button>Hello world</Button>
</Story>
<Story name="padded" parameters={{ layout: 'padded' }}>
<Button>Hello world</Button>
</Story>
<Story name="fullscreen" parameters={{ layout: 'fullscreen' }}>
<Button>Hello world</Button>
</Story>
<Story name="centered" parameters={{ layout: 'centered' }}>
<Button>Hello world</Button>
</Story>
</Preview>