Skip to content

implemented storybook #1258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 63 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["react", "react-hooks", "@typescript-eslint", "eslint-plugin-import-helpers"],
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"eslint-plugin-import-helpers"
],
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module",
Expand All @@ -20,7 +25,8 @@
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
"globals": {
"importScripts": true
Expand All @@ -29,24 +35,64 @@
"import-helpers/order-imports": [
"warn",
{
"groups": [["absolute", "module"], "/^types/", "/^api/", "/^hooks/", "/^pages/", "/^components/", "/^assets/", ["sibling", "parent", "index"]],
"groups": [
[
"absolute",
"module"
],
"/^types/",
"/^api/",
"/^hooks/",
"/^pages/",
"/^components/",
"/^assets/",
[
"sibling",
"parent",
"index"
]
],
"newlinesBetween": "always",
"alphabetize": { "order": "asc", "ignoreCase": true }
"alphabetize": {
"order": "asc",
"ignoreCase": true
}
}
],
"sort-imports": [
"error",
{
"ignoreCase": true,
"ignoreDeclarationSort": true
}
],
"sort-imports": ["error", { "ignoreCase": true, "ignoreDeclarationSort": true }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"arrow-spacing": "error",
"block-spacing": ["error", "never"],
"brace-style": ["error", "1tbs"],
"block-spacing": [
"error",
"never"
],
"brace-style": [
"error",
"1tbs"
],
"comma-spacing": "error",
"comma-style": ["error", "last"],
"comma-style": [
"error",
"last"
],
"endOfLine": "off",
"curly": ["error", "all"],
"curly": [
"error",
"all"
],
"eol-last": "error",
"eqeqeq": ["error", "always"],
"eqeqeq": [
"error",
"always"
],
"func-call-spacing": "error",
"guard-for-in": "off",
"jsx-a11y/accessible-emoji": "off",
Expand All @@ -66,7 +112,9 @@
"no-empty-function": [
"error",
{
"allow": ["arrowFunctions"]
"allow": [
"arrowFunctions"
]
}
],
"no-implicit-coercion": "error",
Expand Down Expand Up @@ -108,7 +156,10 @@
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"import/resolver": {
"typescript": {
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ package-lock.json

.eslintcache
debug.log

*storybook.log
29 changes: 29 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { StorybookConfig } from '@storybook/react-vite';

/**
* Storybook configuration
* This configuration ensures that:
* - All MDX documentation files are included
* - All stories for components in /src/components are included
* - All other stories throughout the src directory are included
*/
const config: StorybookConfig = {
"stories": [
"../src/**/*.mdx",
"../src/components/**/*.stories.@(js|jsx|mjs|ts|tsx)",
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
"addons": [
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@chromatic-com/storybook",
"@storybook/experimental-addon-test",
"@storybook/addon-styling"
],
"framework": {
"name": "@storybook/react-vite",
"options": {}
},
"staticDirs": ["../public"]
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react'
import '../src/assets/css/index.css'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
9 changes: 9 additions & 0 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { beforeAll } from 'vitest';
import { setProjectAnnotations } from '@storybook/react';
import * as projectAnnotations from './preview';

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
const project = setProjectAnnotations([projectAnnotations]);

beforeAll(project.beforeAll);
21 changes: 19 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"emoji-picker-react": "^4.12.0",
"immutability-helper": "^3.1.1",
"lucide-react": "^0.446.0",
"msw": "^2.7.3",
"next-themes": "^0.3.0",
"qr-scanner": "^1.4.2",
"qrcode.react": "^3.2.0",
Expand Down Expand Up @@ -83,9 +84,19 @@
"lint": "eslint --no-fix src --ext .ts,.tsx",
"pre-commit": "eslint --cache --fix src --ext .ts,.tsx",
"format": "eslint --fix src --ext .ts,.tsx",
"prepare": "husky install"
"prepare": "husky install",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"devDependencies": {
"@chromatic-com/storybook": "^3.2.5",
"@storybook/addon-essentials": "^8.6.4",
"@storybook/addon-onboarding": "^8.6.4",
"@storybook/blocks": "^8.6.4",
"@storybook/experimental-addon-test": "^8.6.4",
"@storybook/react": "^8.6.4",
"@storybook/react-vite": "^8.6.4",
"@storybook/test": "^8.6.4",
"@types/canvas-confetti": "^1.6.4",
"@types/node": "^20.16.5",
"@types/react": "^18.3.12",
Expand All @@ -95,22 +106,28 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/browser": "^3.0.8",
"@vitest/coverage-v8": "^3.0.8",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import-helpers": "^1.3.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.11.4",
"husky": "^9.1.6",
"playwright": "^1.51.0",
"postcss": "^8.4.45",
"prettier": "^2.8.8",
"storybook": "^8.6.4",
"tailwindcss": "^3.4.10",
"typescript": "^4.9.5",
"vite": "^5.4.3",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2"
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.0.8"
}
}
Loading