Skip to content

Commit

Permalink
Merge pull request #175 from read-a-perfume/feature/nys
Browse files Browse the repository at this point in the history
fix: storybook 쿼리클라이언트 및 라우팅 에러 해결
  • Loading branch information
nayounsang authored Jan 29, 2024
2 parents cf743eb + ca3d67f commit 3488a96
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 232 deletions.
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: StorybookConfig = {
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'storybook-addon-react-router-v6',
],
core: {
builder: '@storybook/builder-vite',
Expand Down
17 changes: 12 additions & 5 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type {Preview} from '@storybook/react'
import {CssBaseline, ThemeProvider} from '@mui/material'
import {theme} from '../src/theme/index'
import React from 'react'
import {withRouter} from 'storybook-addon-react-router-v6'
import {QueryClient, QueryClientProvider} from '@tanstack/react-query'

export const preview: Preview = {
parameters: {
Expand All @@ -13,18 +15,23 @@ export const preview: Preview = {
date: /Date$/,
},
},
reactRouter: {routePath: ''},
},
}

const client = new QueryClient()

//MUI 테마연동

export const withMuiTheme = Story => {
return (
<ThemeProvider theme={theme}>
<CssBaseline />
<Story />
</ThemeProvider>
<QueryClientProvider client={client}>
<ThemeProvider theme={theme}>
<CssBaseline />
<Story />
</ThemeProvider>
</QueryClientProvider>
)
}

export const decorators = [withMuiTheme]
export const decorators = [withRouter, withMuiTheme]
Loading

0 comments on commit 3488a96

Please sign in to comment.