Skip to content

Commit

Permalink
chore: storybook emotion 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
kimyouknow committed Sep 9, 2023
1 parent 8012761 commit 157488c
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 30 deletions.
8 changes: 7 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path');
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
Expand All @@ -7,13 +8,18 @@ const config: StorybookConfig = {
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'@storybook/addon-styling',
],
framework: {
name: '@storybook/nextjs',
options: {},
options: { nextConfigPath: path.resolve(__dirname, '../next.config.js') },
},
docs: {
autodocs: 'tag',
},
babel: async options => {
options.presets!.push('@emotion/babel-preset-css-prop');
return options;
},
};
export default config;
15 changes: 0 additions & 15 deletions .storybook/preview.ts

This file was deleted.

34 changes: 34 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const path = require('path');

import type { Preview } from '@storybook/react';
import React from 'react';
import GlobalStyle from '../src/styles/globalStyle';

const preview: Preview = {
decorators: [
Story => (
<div>
<GlobalStyle />
<Story />
</div>
),
],
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
webpackFinal: async config => {
config.resolve.alias = {
...config.resolve.alias,
'~': path.resolve(__dirname, '../src/'),
};
return config;
},
},
};

export default preview;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@emotion/babel-preset-css-prop": "^11.11.0",
"@next/bundle-analyzer": "^13.2.1",
"@storybook/addon-essentials": "^7.4.0",
"@storybook/addon-interactions": "^7.4.0",
"@storybook/addon-links": "^7.4.0",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.4.0",
"@storybook/nextjs": "^7.4.0",
"@storybook/react": "^7.4.0",
Expand Down
Loading

0 comments on commit 157488c

Please sign in to comment.