Add Storybook

This commit is contained in:
Konrad Szwarc 2022-08-26 00:25:00 +02:00
parent 38153e42dc
commit f6e2517cb5
7 changed files with 34403 additions and 1752 deletions

3
.storybook/.babelrc Normal file
View file

@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
}

25
.storybook/main.ts Normal file
View file

@ -0,0 +1,25 @@
import type { StorybookViteConfig } from '@storybook/builder-vite';
const config: StorybookViteConfig = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
],
framework: '@storybook/react',
typescript: { check: false },
core: { builder: '@storybook/builder-vite' },
features: {
storyStoreV7: true,
},
viteFinal: (config) => config,
};
export default config;

5
.storybook/preview.ts Normal file
View file

@ -0,0 +1,5 @@
import 'tailwindcss/tailwind.css';
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
};

36093
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,11 +7,18 @@
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"devDependencies": {
"@astrojs/react": "^1.0.0",
"@astrojs/tailwind": "^1.0.0",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/builder-vite": "^0.2.2",
"@storybook/react": "^6.5.10",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"astro": "^1.0.8",

6
postcss.config.cjs Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View file

@ -26,8 +26,6 @@
// Report an error when a parameter is declared but never used.
"noUnusedParameters": true,
// Force the usage of the indexed syntax to access fields declared using an index signature.
"noUncheckedIndexedAccess": true,
// Report an error when the value `undefined` is given to an optional property that doesn't specify `undefined` as a valid value.
"exactOptionalPropertyTypes": true
"noUncheckedIndexedAccess": true
}
}