Skip to content

Commit f2e344e

Browse files
committed
storybook
1 parent d33022c commit f2e344e

File tree

8 files changed

+4999
-1133
lines changed

8 files changed

+4999
-1133
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"presets": [
33
"@babel/preset-env",
4-
"@babel/preset-react"
4+
"@babel/preset-react",
5+
"@babel/preset-typescript"
56
],
67
"plugins": [
78
"@babel/plugin-syntax-dynamic-import"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,5 @@ stories/
108108
storybook-static/
109109
.idea
110110
.DS_Store
111+
112+
*storybook.log

.storybook/main.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { StorybookConfig } from "@storybook/react-webpack5";
2+
import path from "path";
3+
4+
5+
const config: StorybookConfig = {
6+
stories: ["../.examples/**/*.mdx", "../.examples/**/*.stories.@(js|jsx|ts|tsx)"],
7+
addons: [
8+
"@storybook/addon-webpack5-compiler-swc",
9+
"@storybook/addon-onboarding",
10+
"@storybook/addon-links",
11+
"@storybook/addon-essentials",
12+
"@chromatic-com/storybook",
13+
"@storybook/addon-interactions",
14+
"@storybook/addon-webpack5-compiler-babel"
15+
],
16+
framework: {
17+
name: "@storybook/react-webpack5",
18+
options: {},
19+
},
20+
docs: {
21+
autodocs: true,
22+
},
23+
webpackFinal: async (config, { configType }) => {
24+
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
25+
// You can change the configuration based on that.
26+
// 'PRODUCTION' is used when building the static version of storybook.
27+
28+
// Make whatever fine-grained changes you need
29+
config.module?.rules?.push({
30+
test: /\.less$/,
31+
use: ['style-loader', 'css-loader', 'less-loader'],
32+
include: path.resolve(__dirname, '../'),
33+
});
34+
config.module?.rules?.push({
35+
test: /\.ipynb$/,
36+
use: ['json-loader'],
37+
include: path.resolve(__dirname, '../'),
38+
});
39+
// Return the altered config
40+
return config;
41+
},
42+
};
43+
export default config;

.storybook/preview.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.storybook/preview.ts

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

package.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"test": "echo \"Error: no test specified\" && exit 1",
1010
"build": "rm -rf ./dist && webpack",
1111
"analyze": "rm -rf ./dist && webpack --analyze",
12-
"storybook": "start-storybook -p 6006",
13-
"build-storybook": "build-storybook",
12+
"storybook": "storybook dev -p 6006",
13+
"build-storybook": "storybook build",
1414
"build-default-css": "lessc --clean-css ./src/styles/default.less ./dist/styles/default.css",
1515
"build-dark-css": "lessc --clean-css ./src/styles/dark.less ./dist/styles/dark.css",
1616
"build-darkbronco-css": "lessc --clean-css ./src/styles/darkbronco.less ./dist/styles/darkbronco.css",
@@ -41,10 +41,18 @@
4141
"@babel/preset-env": "^7.14.4",
4242
"@babel/preset-react": "^7.13.13",
4343
"@babel/preset-typescript": "^7.13.0",
44-
"@storybook/addon-actions": "^6.0.21",
45-
"@storybook/addon-essentials": "^6.0.21",
46-
"@storybook/addon-links": "^6.0.21",
47-
"@storybook/react": "^6.0.21",
44+
"@chromatic-com/storybook": "^1.2.22",
45+
"@storybook/addon-actions": "^8.0.0",
46+
"@storybook/addon-essentials": "^8.0.0",
47+
"@storybook/addon-interactions": "^8.0.0",
48+
"@storybook/addon-links": "^8.0.0",
49+
"@storybook/addon-onboarding": "^8.0.0",
50+
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
51+
"@storybook/addon-webpack5-compiler-swc": "^1.0.2",
52+
"@storybook/blocks": "^8.0.0",
53+
"@storybook/react": "^8.0.0",
54+
"@storybook/react-webpack5": "^8.0.0",
55+
"@storybook/test": "^8.0.0",
4856
"@types/dompurify": "^2.4.0",
4957
"@types/katex": "^0.11.1",
5058
"@types/node": "^15.12.1",
@@ -57,6 +65,7 @@
5765
"eslint": "^7.19.0",
5866
"eslint-config-prettier": "^7.2.0",
5967
"eslint-plugin-prettier": "^3.3.1",
68+
"eslint-plugin-storybook": "^0.8.0",
6069
"file-loader": "^6.2.0",
6170
"json-loader": "^0.5.7",
6271
"katex": "^0.13.18",
@@ -69,6 +78,7 @@
6978
"react-is": "^16.13.1",
7079
"rehype-katex": "^6.0.2",
7180
"require-context.macro": "^1.2.2",
81+
"storybook": "^8.0.0",
7282
"ts-loader": "8.2.0",
7383
"typescript": "^4.0.3",
7484
"typescript-declaration-webpack-plugin": "^0.2.2",
@@ -97,5 +107,10 @@
97107
"repository": {
98108
"type": "git",
99109
"url": "git+https://github.com/righ/react-ipynb-renderer.git"
110+
},
111+
"eslintConfig": {
112+
"extends": [
113+
"plugin:storybook/recommended"
114+
]
100115
}
101116
}

0 commit comments

Comments
 (0)