Skip to content

Commit c03ce67

Browse files
authored
feat: setup storybook (#121)
* setup storybook * remove testing component
1 parent 8fa6479 commit c03ce67

File tree

12 files changed

+23460
-13384
lines changed

12 files changed

+23460
-13384
lines changed

.babelrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100,
9+
"safari": 15,
10+
"firefox": 91
11+
}
12+
}
13+
],
14+
"@babel/preset-typescript",
15+
"@babel/preset-react"
16+
],
17+
"plugins": []
18+
}

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
2+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:storybook/recommended'],
33
rules: {
44
// A temporary hack related to IDE not resolving correct package.json
55
'import/no-extraneous-dependencies': 'off',

.storybook/main.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import type { StorybookConfig } from '@storybook/react-webpack5';
2+
import path from 'path';
3+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
4+
5+
const config: StorybookConfig = {
6+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
7+
addons: [
8+
'@storybook/addon-links',
9+
'@storybook/addon-essentials',
10+
'@storybook/addon-onboarding',
11+
'@storybook/addon-interactions',
12+
{
13+
name: '@storybook/addon-styling',
14+
options: {
15+
sass: {
16+
// Require your Sass preprocessor here
17+
implementation: require('sass'),
18+
},
19+
},
20+
},
21+
],
22+
webpackFinal: async (config, { configType }) => {
23+
if (config.resolve) {
24+
config.resolve.plugins = [
25+
...(config.resolve.plugins ?? []),
26+
new TsconfigPathsPlugin({
27+
configFile: path.resolve(__dirname, '../tsconfig.json'),
28+
}),
29+
];
30+
}
31+
return config;
32+
},
33+
framework: {
34+
name: '@storybook/react-webpack5',
35+
options: {},
36+
},
37+
docs: {
38+
autodocs: 'tag',
39+
},
40+
};
41+
export default config;

.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';
2+
3+
const preview: Preview = {
4+
parameters: {
5+
actions: { argTypesRegex: '^on[A-Z].*' },
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/,
10+
},
11+
},
12+
},
13+
};
14+
15+
export default preview;

0 commit comments

Comments
 (0)