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 story names to preserve component history #96

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions src/components/Avatar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export const large = () => (
</div>
);

large.story = {
name: 'large',
};

export const medium = () => (
<div>
<Avatar loading />
Expand All @@ -30,6 +34,10 @@ export const medium = () => (
</div>
);

medium.story = {
name: 'medium',
};

export const small = () => (
<div>
<Avatar loading size="small" />
Expand All @@ -42,6 +50,10 @@ export const small = () => (
</div>
);

small.story = {
name: 'small',
};

export const tiny = () => (
<div>
<Avatar loading size="tiny" />
Expand All @@ -53,3 +65,7 @@ export const tiny = () => (
/>
</div>
);

tiny.story = {
name: 'tiny',
};
19 changes: 19 additions & 0 deletions src/components/AvatarList.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ export default {
};

export const short = () => <AvatarList users={users.slice(0, 2)} />;

short.story = {
name: 'short',
};

export const ellipsized = () => <AvatarList users={users} />;

ellipsized.story = {
name: 'ellipsized',
};

export const bigUserCount = () => <AvatarList users={users} userCount={100} />;

bigUserCount.story = {
Expand All @@ -46,4 +56,13 @@ smallSize.story = {
};

export const loading = () => <AvatarList loading />;

loading.story = {
name: 'loading',
};

export const empty = () => <AvatarList users={[]} />;

empty.story = {
name: 'empty',
};
4 changes: 4 additions & 0 deletions src/components/Badge.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export const all = () => (
</div>
);

all.story = {
name: 'all',
};

export const withIcon = () => (
<Badge status="warning">
<Icon icon="check" inline />
Expand Down
20 changes: 20 additions & 0 deletions src/components/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const buttons = () => (
</>
);

buttons.story = {
name: 'buttons',
};

export const sizes = () => (
<>
<Button appearance="primary">Default</Button>
Expand All @@ -43,6 +47,10 @@ export const sizes = () => (
</>
);

sizes.story = {
name: 'sizes',
};

export const loading = () => (
<>
<Button appearance="primary" isLoading>
Expand All @@ -63,6 +71,10 @@ export const loading = () => (
</>
);

loading.story = {
name: 'loading',
};

export const disabled = () => (
<>
<Button appearance="primary" isDisabled>
Expand All @@ -80,6 +92,10 @@ export const disabled = () => (
</>
);

disabled.story = {
name: 'disabled',
};

export const containsIcon = () => (
<>
<Button appearance="outline" containsIcon>
Expand All @@ -91,6 +107,10 @@ export const containsIcon = () => (
</>
);

containsIcon.story = {
name: 'containsIcon',
};

export const buttonWrapper = () => (
<div>
<ButtonWrapper>Original Button Wrapper</ButtonWrapper>
Expand Down
8 changes: 8 additions & 0 deletions src/components/Checkbox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export const unchecked = () => (
<Checkbox id="Unchecked" label="Cats" hideLabel onChange={onChange} />
);

unchecked.story = {
name: 'unchecked',
};

export const checked = () => (
<Checkbox id="Checked" label="Cats" hideLabel checked onChange={onChange} />
);

checked.story = {
name: 'checked',
};
28 changes: 28 additions & 0 deletions src/components/Highlight.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export const bash = () => (
</>
);

bash.story = {
name: 'bash',
};

export const javascript = () => (
<>
<strong>Autoformat</strong>
Expand All @@ -95,6 +99,10 @@ export const javascript = () => (
</>
);

javascript.story = {
name: 'javascript',
};

export const typescript = () => (
<>
<strong>Autoformat</strong>
Expand All @@ -104,6 +112,10 @@ export const typescript = () => (
</>
);

typescript.story = {
name: 'typescript',
};

export const css = () => (
<>
<strong>Autoformat</strong>
Expand All @@ -113,6 +125,10 @@ export const css = () => (
</>
);

css.story = {
name: 'css',
};

export const json = () => (
<>
<strong>Autoformat</strong>
Expand All @@ -122,6 +138,10 @@ export const json = () => (
</>
);

json.story = {
name: 'json',
};

const SmallContainer = styled.div`
max-width: 300px;
`;
Expand All @@ -132,6 +152,10 @@ export const wrapping = () => (
</SmallContainer>
);

wrapping.story = {
name: 'wrapping',
};

const StyledHighlight = styled(Highlight)`
code,
pre {
Expand All @@ -140,3 +164,7 @@ const StyledHighlight = styled(Highlight)`
`;

export const customStyling = () => <StyledHighlight language="json">{jsonCode}</StyledHighlight>;

customStyling.story = {
name: 'customStyling',
};
16 changes: 16 additions & 0 deletions src/components/Icon.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export const labels = () => (
</Fragment>
);

labels.story = {
name: 'labels',
};

export const noLabels = () => (
<List>
{Object.keys(icons).map(key => (
Expand All @@ -77,14 +81,26 @@ export const noLabels = () => (
</List>
);

noLabels.story = {
name: 'noLabels',
};

export const inline = () => (
<Fragment>
this is an inline <Icon icon="facehappy" aria-label="Happy face" /> icon (default)
</Fragment>
);

inline.story = {
name: 'inline',
};

export const block = () => (
<Fragment>
this is a block <Icon icon="facehappy" aria-label="Happy face" block /> icon
</Fragment>
);

block.story = {
name: 'block',
};
16 changes: 16 additions & 0 deletions src/components/Input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ export const secondary = () => (
</form>
);

secondary.story = {
name: 'secondary',
};

export const tertiary = () => (
<form style={{ background: '#EEEEEE', padding: '3em' }}>
<Input
Expand Down Expand Up @@ -231,6 +235,10 @@ export const tertiary = () => (
</form>
);

tertiary.story = {
name: 'tertiary',
};

export const pill = () => (
<Input
id="Pill"
Expand All @@ -243,6 +251,10 @@ export const pill = () => (
/>
);

pill.story = {
name: 'pill',
};

export const code = () => (
<form style={{ background: '#EEEEEE', padding: '3em' }}>
<Input
Expand Down Expand Up @@ -274,3 +286,7 @@ export const code = () => (
/>
</form>
);

code.story = {
name: 'code',
};
24 changes: 24 additions & 0 deletions src/components/Link.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,52 @@ export const all = () => (
</>
);

all.story = {
name: 'all',
};

export const withArrow = () => (
<Link containsIcon withArrow href="https://learnstorybook.com">
withArrow shows an arrow behind the link
</Link>
);

withArrow.story = {
name: 'withArrow',
};

export const containsIcon = () => (
<Link containsIcon href="https://learnstorybook.com" aria-label="Toggle side bar">
<Icon icon="sidebar" aria-hidden />
</Link>
);

containsIcon.story = {
name: 'containsIcon',
};

export const icon = () => (
<Link href="https://learnstorybook.com">
<Icon icon="discord" aria-hidden />
Link with an icon in front
</Link>
);

icon.story = {
name: 'icon',
};

export const isButton = () => (
/* eslint-disable-next-line */
<Link isButton onClick={onLinkClick}>
is actually a button
</Link>
);

isButton.story = {
name: 'isButton',
};

export const hasLinkWrapper = () => (
<>
{/* gatsby and styled-components don't work nicely together */}
Expand All @@ -77,3 +97,7 @@ export const hasLinkWrapper = () => (
</CustomLink>
</>
);

hasLinkWrapper.story = {
name: 'hasLinkWrapper',
};
20 changes: 20 additions & 0 deletions src/components/ProgressDots.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@ export default {
};

export const loading = () => <ProgressDots loading />;

loading.story = {
name: 'loading',
};

export const starting = () => <ProgressDots steps={4} progress={1} />;

starting.story = {
name: 'starting',
};

export const halfway = () => <ProgressDots steps={4} progress={2} />;

halfway.story = {
name: 'halfway',
};

export const complete = () => <ProgressDots steps={4} progress={4} />;

complete.story = {
name: 'complete',
};

export const largeComplete = () => <ProgressDots steps={4} progress={4} size="large" />;

largeComplete.story = {
Expand Down
Loading