Skip to content

Commit

Permalink
feat(storybook): add initial setup (#20)
Browse files Browse the repository at this point in the history
* feat(storybook): add initial setup

* feat(storybook): add FormSelect stories
  • Loading branch information
onetdev authored Apr 5, 2024
1 parent ba82363 commit ad4f936
Show file tree
Hide file tree
Showing 10 changed files with 6,927 additions and 876 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:storybook/recommended',
],
rules: {
'import/order': [
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

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

const config: StorybookConfig = {
stories: [
'../src/**/*.mdx',
'../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {},
},
docs: {
autodocs: 'tag',
},
staticDirs: ['../public'],
webpackFinal: async (config) => {
if (!config.resolve) {
return config;
}

config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '../src'),
};
return config;
},
};
export default config;
14 changes: 14 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from '@storybook/react';

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

export default preview;
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"rubymaniac.vscode-direnv",
"styled-components.vscode-styled-components"
"styled-components.vscode-styled-components",
"unifiedjs.vscode-mdx"
]
}
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"test:once": "jest",
"test:ci": "jest --ci",
"prepare": "husky",
"gen-manifest": "tsx ./scripts/gen-manifest.ts"
"gen-manifest": "tsx ./scripts/gen-manifest.ts",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
Expand Down Expand Up @@ -49,9 +51,18 @@
"styled-components": "6.1.8"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.0",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@next/eslint-plugin-next": "^14",
"@storybook/addon-essentials": "^8.0.5",
"@storybook/addon-interactions": "^8.0.5",
"@storybook/addon-links": "^8.0.5",
"@storybook/addon-onboarding": "^8.0.5",
"@storybook/blocks": "^8.0.5",
"@storybook/nextjs": "^8.0.5",
"@storybook/react": "^8.0.5",
"@storybook/test": "^8.0.5",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@types/color": "^3.0.6",
Expand All @@ -68,17 +79,19 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-storybook": "^0.8.0",
"favicons": "^7.2.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"storybook": "^8.0.5",
"tsx": "^4.7.1",
"typescript": "^5.3"
},
"peerDependencies": {
"react-i18next": "^14.1.0",
"i18next": "^23.10.1"
"i18next": "^23.10.1",
"react-i18next": "^14.1.0"
}
}
Loading

0 comments on commit ad4f936

Please sign in to comment.