Skip to content

Commit aa1251a

Browse files
authored
Feat: Use storybook to display public components. #9914 (#9915)
### What problem does this PR solve? Feat: Use storybook to display public components. #9914 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
1 parent 483f3aa commit aa1251a

34 files changed

+4069
-320
lines changed

web/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
/src/.umi-test
88
/dist
99
.swc
10+
11+
*storybook.log
12+
storybook-static

web/.storybook/main.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import type { StorybookConfig } from '@storybook/react-webpack5';
2+
import path from 'path';
3+
4+
const config: StorybookConfig = {
5+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
6+
addons: [
7+
'@storybook/addon-webpack5-compiler-swc',
8+
'@storybook/addon-docs',
9+
'@storybook/addon-onboarding',
10+
{
11+
name: '@storybook/addon-styling-webpack',
12+
options: {
13+
rules: [
14+
{
15+
test: /\.css$/,
16+
use: [
17+
'style-loader',
18+
'css-loader',
19+
{
20+
loader: 'postcss-loader',
21+
options: {
22+
postcssOptions: {
23+
plugins: [require('tailwindcss'), require('autoprefixer')],
24+
},
25+
},
26+
},
27+
],
28+
},
29+
],
30+
},
31+
},
32+
],
33+
framework: {
34+
name: '@storybook/react-webpack5',
35+
options: {},
36+
},
37+
webpackFinal: async (config) => {
38+
if (config.resolve) {
39+
config.resolve.alias = {
40+
...config.resolve.alias,
41+
'@': path.resolve(__dirname, '../src'),
42+
};
43+
}
44+
return config;
45+
},
46+
};
47+
export default config;

web/.storybook/preview.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Preview } from '@storybook/react-webpack5';
2+
import '../tailwind.css';
3+
4+
const preview: Preview = {
5+
parameters: {
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/i,
10+
},
11+
},
12+
},
13+
};
14+
15+
export default preview;

0 commit comments

Comments
 (0)