-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from kash9350/create-user-button-component
Storybook configuration with 2 stories added
- Loading branch information
Showing
24 changed files
with
19,456 additions
and
8,875 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ node_modules | |
.cache | ||
dist | ||
.parcel-cache | ||
.yalc | ||
.yalc | ||
*storybook.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
import type { WebpackConfiguration } from '@storybook/core-webpack'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-webpack5-compiler-swc', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
'@storybook/addon-styling-webpack', | ||
'@storybook/preset-scss' | ||
], | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: { | ||
strictMode: true, | ||
}, | ||
}, | ||
webpackFinal: async (currentConfig: WebpackConfiguration, { configType }) => { | ||
// get index of css rule | ||
const ruleCssIndex = currentConfig.module.rules.findIndex( | ||
(rule) => rule.test?.toString() === "/\\.css$/" | ||
); | ||
|
||
// map over the 'use' array of the css rule and set the 'module' option to true | ||
currentConfig.module.rules[ruleCssIndex].use.map((item) => { | ||
if (item.loader && item.loader.includes("/css-loader/")) { | ||
item.options.modules = { | ||
mode: "local", | ||
localIdentName: | ||
configType === "PRODUCTION" | ||
? "[local]__[hash:base64:5]" | ||
: "[name]__[local]__[hash:base64:5]", | ||
}; | ||
} | ||
|
||
return item; | ||
}); | ||
|
||
return currentConfig; | ||
}, | ||
}; | ||
export default config; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
tags: ['autodocs'] | ||
}; | ||
|
||
export default preview; |
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
Oops, something went wrong.