Skip to content

Commit

Permalink
Merge pull request #45 from domjacks/switch-to-csf
Browse files Browse the repository at this point in the history
Simplified story loading as it was broken
  • Loading branch information
Dom Jackson authored Sep 7, 2019
2 parents 63d6af2 + 9db9e82 commit 59715e9
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 72 deletions.
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
File renamed without changes.
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.

File renamed without changes.

0 comments on commit 59715e9

Please sign in to comment.