Last active
May 17, 2021 07:59
-
-
Save pot-code/976d1356d4ac7232db04b33201883258 to your computer and use it in GitHub Desktop.
[storybook Chakra UI] #frontend #storybook #template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
stories: [ | |
'../stories/**/*.stories.mdx', | |
'../stories/**/*.stories.@(js|jsx|ts|tsx)', | |
'../components/**/*.stories.@(js|jsx|ts|tsx)', | |
], | |
addons: [ | |
'@storybook/addon-links', | |
'@storybook/addon-essentials', | |
{ | |
name: '@storybook/preset-scss', | |
options: { | |
cssLoaderOptions: { | |
modules: true, | |
}, | |
sassLoaderOptions: { | |
sassOptions: { | |
includePaths: [ | |
path.resolve(__dirname, '../styles'), | |
path.resolve(__dirname, '../node_modules'), | |
], | |
}, | |
}, | |
}, | |
}, | |
], | |
webpackFinal: async (config) => { | |
return { | |
...config, | |
resolve: { | |
...config.resolve, | |
alias: { | |
...config.resolve.alias, | |
'@emotion/core': path.join(process.cwd(), 'node_modules/@emotion/react'), | |
'emotion-theming': path.join(process.cwd(), 'node_modules/@emotion/react'), | |
}, | |
}, | |
}; | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add -D @storybook/preset-scss css-loader sass-loader@10 style-loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChakraProvider, extendTheme } from '@chakra-ui/react'; | |
import React from 'react'; | |
import '../styles/globals.scss'; | |
export const parameters = { | |
actions: { argTypesRegex: '^on[A-Z].*' }, | |
controls: { | |
matchers: { | |
color: /(background|color)$/i, | |
date: /Date$/, | |
}, | |
}, | |
}; | |
const theme = extendTheme({ | |
}); | |
export const decorators = [ | |
(Story) => ( | |
<ChakraProvider theme={theme} resetCSS={true}> | |
<Story /> | |
</ChakraProvider> | |
), | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment