Skip to content
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

feat: storybook #3

Merged
merged 14 commits into from
Oct 28, 2024
Merged
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
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'prettier',
'plugin:storybook/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
Expand All @@ -17,6 +18,6 @@ module.exports = {
],
'@typescript-eslint/no-explicit-any': 'off',
'react-hooks/rules-of-hooks': 'off',
'react-refresh/only-export-components': 'off',
'react-hooks/exhaustive-deps': 'error',
},
}
56 changes: 56 additions & 0 deletions .github/workflows/check-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lint and build

on:
pull_request:
branches:
- main
paths:
- "**"
- "!README.md"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install packages
run: npm i

- name: Run TypeScript Compiler
run: npm run tsc

- name: Run ESLint
run: npm run lint
permissions:
contents: read
pull-requests: read
checks: write

build:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install packages
run: npm i

- name: Build
run: npm run build
permissions:
contents: read
pull-requests: read
checks: write
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.parcel-cache
/dist
/dist
*storybook.log
25 changes: 25 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { StorybookConfig } from '@storybook/react-vite'
import autoprefixer from 'autoprefixer'
import tailwindcss from 'tailwindcss'
import { mergeConfig } from 'vite'
import svgr from 'vite-plugin-svgr'

const config: StorybookConfig = {
'stories': ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
'addons': ['@storybook/addon-essentials'],
'framework': {
'name': '@storybook/react-vite',
'options': {},
},
async viteFinal(config) {
return mergeConfig(config, {
plugins: [svgr()],
css: {
postcss: {
plugins: [tailwindcss(), autoprefixer()],
},
},
})
},
}
export default config
28 changes: 28 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ChakraProvider } from '@chakra-ui/react'
import type { Preview } from '@storybook/react'
import { MemoryRouter } from 'react-router-dom'
import theme from '../src/theme'
import '../styles/index.css'
import './storybook.css'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
(Story) => (
<ChakraProvider theme={theme}>
<MemoryRouter>
<Story />
</MemoryRouter>
</ChakraProvider>
),
],
}

export default preview
3 changes: 3 additions & 0 deletions .storybook/storybook.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#storybook-root {
height: 100%;
}
Loading
Loading