Skip to content

Commit

Permalink
config: 스토리북에 theme관련 설정 추가
Browse files Browse the repository at this point in the history
1. 스토리북 themeProvider 적용
2. 스토리북 디렉터리 하위에도 tsc 적용되도록 설정 추가
  • Loading branch information
Creative-Lee committed Jul 27, 2023
1 parent a5aa32b commit a4f10b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: StorybookConfig = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-styling',
],
framework: {
name: '@storybook/react-webpack5',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Preview } from '@storybook/react';
import { withThemeFromJSXProvider } from '@storybook/addon-styling';
import GlobalStyles from '../src/styles/GlobalStyles';
import { ThemeProvider } from 'styled-components';
import theme from '../src/styles/theme';

const preview: Preview = {
parameters: {
Expand All @@ -12,7 +14,14 @@ const preview: Preview = {
},
},
},
decorators: [withThemeFromJSXProvider({ GlobalStyles })],
decorators: [
(Story) => (
<ThemeProvider theme={theme}>
<Story />
</ThemeProvider>
),
withThemeFromJSXProvider({ GlobalStyles }),
],
};

export default preview;
2 changes: 1 addition & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"@/*": ["src/*"]
}
},
"include": ["src"]
"include": ["src", ".storybook/*"]
}

0 comments on commit a4f10b4

Please sign in to comment.