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

Simplified story loading as it was broken #45

Merged
merged 7 commits into from
Sep 7, 2019
Merged
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
11 changes: 1 addition & 10 deletions .storybook/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,4 @@ addParameters({
},
});

// automatically import all files ending in *.stories.js
const componentStories = require.context(
`../src/components/`,
true,
/stories\.tsx$/
);
const tokenStories = require.context(`../src/tokens/`, true, /stories\.tsx$/);

configure(componentStories, module);
configure(tokenStories, module);
configure(require.context('../src/', true, /stories\.tsx$/), module);
9 changes: 8 additions & 1 deletion .storybook/presets.js
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
module.exports = ['@storybook/addon-docs/react/preset'];
module.exports = [
{
name: '@storybook/addon-docs/react/preset',
options: {
sourceLoaderOptions: null,
},
},
];
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from './';
import { Button } from '.';

export default { title: 'Components | Button', component: Button };

Expand Down
60 changes: 60 additions & 0 deletions src/tokens/colors/colors.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, { FC } from 'react';
import { storiesOf } from '@storybook/react';
import styled from 'styled-components';
import { Paragraph } from '../../components';
import { colors } from './colors';

interface CircleProps {
color: string;
}

const StyledCircle = styled.div<CircleProps>`
height: 100px;
width: 100px;
margin: 20px;
border-radius: 50%;
background-color: ${props => props.color};
`;

const StyledParagraph = styled(Paragraph)<{ color: string }>`
color: ${props => props.color};
line-height: 100px;
`;

const Container = styled.div<{ color?: string }>`
background-color: ${props => props.color};
padding: 20px;
display: grid;
grid-template-columns: repeat(2, 1fr);
`;

const Circle: FC<CircleProps> = ({ color }) => {
return <StyledCircle color={color} />;
};

export default { title: 'Tokens | Colors' };

export const palette = () => (
<Container>
<StyledParagraph color={colors.light.body}>Light</StyledParagraph>
<StyledParagraph color={colors.light.body}>Dark</StyledParagraph>

<Container color={colors.light.accent}>
<Circle color={colors.light.primary} />
<StyledParagraph color={colors.light.body}>Primary</StyledParagraph>
<Circle color={colors.light.secondary} />
<StyledParagraph color={colors.light.body}>Secondary</StyledParagraph>
<Circle color={colors.light.body} />
<StyledParagraph color={colors.light.body}>Body</StyledParagraph>
</Container>

<Container color={colors.dark.accent}>
<Circle color={colors.dark.primary} />
<StyledParagraph color={colors.dark.body}>Primary</StyledParagraph>
<Circle color={colors.dark.secondary} />
<StyledParagraph color={colors.dark.body}>Secondary</StyledParagraph>
<Circle color={colors.dark.body} />
<StyledParagraph color={colors.dark.body}>Body</StyledParagraph>
</Container>
</Container>
);
60 changes: 0 additions & 60 deletions src/tokens/colors/stories.tsx

This file was deleted.