Skip to content

Commit

Permalink
feat(storybook): implement storybook example
Browse files Browse the repository at this point in the history
  • Loading branch information
chornos13 committed Jan 20, 2021
1 parent 5d25d51 commit d4478e9
Show file tree
Hide file tree
Showing 40 changed files with 135 additions and 19,341 deletions.
Empty file added .storybook/addons.js
Empty file.
66 changes: 66 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const path = require('path')

module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-links',
'@storybook/addon-controls',
'storybook-addon-react-docgen',
'storybook-formik/register',
],
webpackFinal: async (baseConfig) => {
const { module = {} } = baseConfig

// Remove original less loader
baseConfig.module.rules = baseConfig.module.rules.filter(
(f) => f.test.toString() !== '/\\.less$/',
)

const newConfig = {
...baseConfig,
module: {
...module,
rules: [...(module.rules || [])],
},
}

// Less
newConfig.module.rules.push({
test: /\.less$/,
include: [
// Include antd to rebuild
/[\\/]node_modules[\\/].*antd/,
path.resolve(__dirname, '../assets/styles'),
],
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
},
],
})

//Resolve Alias Module (import absolute path)
newConfig.resolve.modules = [
...(newConfig.resolve.modules || []),
path.resolve(__dirname, '../'),
path.resolve(__dirname, '../src'),
]

return newConfig
},
typescript: {
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => {
return !prop.parent
},
},
},
}
3 changes: 3 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
}
5 changes: 0 additions & 5 deletions jsconfig.json

This file was deleted.

Loading

0 comments on commit d4478e9

Please sign in to comment.