Skip to content

Commit

Permalink
fix: 스토리북 데코레이터를 워크샵에서 관리하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
cobocho committed Jun 12, 2024
1 parent ce2d017 commit d32e452
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Meta, StoryObj } from '@storybook/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

import { SearchWindow } from './SearchWindow'

Expand All @@ -14,9 +13,7 @@ const meta = {
height: '600px',
}}
>
<QueryClientProvider client={new QueryClient()}>
<Story />
</QueryClientProvider>
<Story />
</div>
),
],
Expand Down
25 changes: 17 additions & 8 deletions apps/extension/components/TermItem/TermItem.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,27 @@ const meta = {
'<strong>서버</strong>는 네트워크에 연결된 컴퓨터로 클라이언트의 요청을 받아 처리하고 결과를 응답으로 보냅니다. 웹 <strong>서버</strong>, 데이터 베이스 <strong>서버</strong>, 메일 <strong>서버</strong> 등이 <strong>서버</strong>에 속합니다.',
},
},
decorators: [
(Story) => (
<div style={{ width: '600px' }}>
<Story />
</div>
),
],
argTypes: {
term: {
control: {
type: 'object',
},
},
},
tags: ['autodocs'],
} satisfies Meta<typeof TermItem>

export default meta

type Story = StoryObj<typeof meta>

export const Preview: Story = {}
export const Preview: Story = {
args: {
term: {
term: '<strong>서버</strong>',
synonyms: 'Server',
meaning:
'<strong>서버</strong>는 네트워크에 연결된 컴퓨터로 클라이언트의 요청을 받아 처리하고 결과를 응답으로 보냅니다. 웹 <strong>서버</strong>, 데이터 베이스 <strong>서버</strong>, 메일 <strong>서버</strong> 등이 <strong>서버</strong>에 속합니다.',
},
},
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Step, Text } from '@vook-client/design-system'

import { onboardingHeader, stepArea } from './OnboardingHeader.css'
Expand Down
16 changes: 7 additions & 9 deletions apps/web/src/app/(onboarding)/onboarding/funnel/page.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ import { OnBoardingProvider } from '../_context/useOnboarding'

import OnboardingFunnel from './page'

const meta = {
const meta: Meta<typeof OnboardingFunnel> = {
title: 'OnboardingFunnel',
component: OnboardingFunnel,
parameters: {
layout: 'centered',
msw: {},
},
} satisfies Meta<typeof OnboardingFunnel>

export default meta

type Story = StoryObj<typeof meta>

export const Preview: Story = {
decorators: [
(Story) => (
<OnBoardingProvider>
Expand All @@ -27,3 +19,9 @@ export const Preview: Story = {
),
],
}

export default meta

type Story = StoryObj<typeof meta>

export const Preview: Story = {}
15 changes: 3 additions & 12 deletions apps/web/src/app/(onboarding)/onboarding/job/page.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import {
AppRouterContext,
type AppRouterInstance,
} from 'next/dist/shared/lib/app-router-context.shared-runtime'
import React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

import { OnBoardingProvider } from '../_context/useOnboarding'

Expand All @@ -18,13 +13,9 @@ const meta: Meta<typeof OnboardingJobPage> = {
},
decorators: [
(Story) => (
<AppRouterContext.Provider value={{} as AppRouterInstance}>
<QueryClientProvider client={new QueryClient()}>
<OnBoardingProvider>
<Story />
</OnBoardingProvider>
</QueryClientProvider>
</AppRouterContext.Provider>
<OnBoardingProvider>
<Story />
</OnBoardingProvider>
),
],
}
Expand Down
16 changes: 3 additions & 13 deletions apps/web/src/components/SignUpForm/SignUpForm.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
AppRouterContext,
type AppRouterInstance,
} from 'next/dist/shared/lib/app-router-context.shared-runtime'
import type { Meta, StoryObj } from '@storybook/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

import { SignUpForm } from './SignUpForm'

Expand All @@ -13,16 +8,11 @@ const meta: Meta<typeof SignUpForm> = {
layout: 'centered',
},
component: SignUpForm,
tags: ['autodocs'],
decorators: [
(Story) => (
<AppRouterContext.Provider value={{} as AppRouterInstance}>
<QueryClientProvider client={new QueryClient()}>
<div style={{ width: 400 }}>
<Story />
</div>
</QueryClientProvider>
</AppRouterContext.Provider>
<div style={{ width: 400 }}>
<Story />
</div>
),
],
}
Expand Down
1 change: 0 additions & 1 deletion apps/workshop/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { addons } from '@storybook/manager-api'
import { themes } from '@storybook/theming'
import { create } from '@storybook/theming/create'

addons.setConfig({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { initialize, mswLoader } from 'msw-storybook-addon'

import { Preview } from '@storybook/react'

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import {
AppRouterContext,
type AppRouterInstance,
} from 'next/dist/shared/lib/app-router-context.shared-runtime'

initialize()

const preview: Preview = {
Expand All @@ -24,6 +30,15 @@ const preview: Preview = {
},
},
loaders: [mswLoader],
decorators: [
(Story) => (
<AppRouterContext.Provider value={{} as AppRouterInstance}>
<QueryClientProvider client={new QueryClient()}>
<Story />
</QueryClientProvider>
</AppRouterContext.Provider>
),
],
}

export default preview
2 changes: 2 additions & 0 deletions apps/workshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@tanstack/react-query": "^5.32.0",
"@vook-client/api": "*",
"@vook-client/design-system": "*",
"next": "^14.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d32e452

Please sign in to comment.