Skip to content

Commit

Permalink
fix: storybook 바벨 이슈 수정 (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhyojeong committed Oct 26, 2023
2 parents d0b416f + 56a7d84 commit a8bac68
Show file tree
Hide file tree
Showing 70 changed files with 5,225 additions and 7,379 deletions.
13 changes: 10 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')

module.exports = {
stories: ['../src/components/**/*.stories.@(js|jsx|ts|tsx)'],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions'
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5'

framework: {
name: '@storybook/nextjs',
options: {}
},

webpackFinal: async config => {
config.resolve.plugins = [
...(config.resolve.plugins || []),
Expand All @@ -19,5 +22,9 @@ module.exports = {
})
]
return config
},

docs: {
autodocs: true
}
}
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
"build": "next build",
"start": "next start",
"lint": "tsc --noEmit && eslint --ext .ts,.tsx src",
"storybook": "start-storybook -s public -p 6006",
"build-storybook": "build-storybook",
"storybook": "storybook dev -s public -p 6006",
"build-storybook": "storybook build",
"test": "jest --env=jsdom",
"prettier": "prettier '**/*.{json,js,jsx,ts,tsx}' --write",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"prepare": "husky install",
"stylelint": "stylelint './src/**/*.{js,jsx,ts,tsx}' --fix"
},
Expand All @@ -33,14 +31,13 @@
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-interactions": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/builder-webpack5": "^6.5.9",
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/react": "^6.5.9",
"@storybook/testing-library": "^0.0.13",
"@storybook/addon-actions": "^7.5.1",
"@storybook/addon-essentials": "^7.5.1",
"@storybook/addon-interactions": "^7.5.1",
"@storybook/addon-links": "^7.5.1",
"@storybook/nextjs": "^7.5.1",
"@storybook/react": "^7.5.1",
"@storybook/testing-library": "^0.2.2",
"@stylelint/postcss-css-in-js": "^0.38.0",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.17.0",
Expand All @@ -52,7 +49,6 @@
"@types/react-dom": "18.0.6",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"@vitejs/plugin-react": "^2.2.0",
"babel-jest": "^29.6.2",
"babel-loader": "^8.2.5",
"eslint": "8.21.0",
Expand All @@ -62,7 +58,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest-dom": "^4.0.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-storybook": "^0.6.3",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-testing-library": "^5.9.1",
"husky": "^8.0.1",
"jest": "^29.6.2",
Expand All @@ -76,15 +72,18 @@
"postcss": "^8.4.27",
"postcss-syntax": "^0.36.2",
"prettier": "2.7.1",
"storybook": "^7.5.1",
"stylelint": "^15.10.2",
"stylelint-config-standard": "^34.0.0",
"stylelint-order": "^6.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "4.7.4",
"vite-tsconfig-paths": "^4.0.3",
"vitest": "^0.25.3"
"typescript": "4.7.4"
},
"resolutions": {
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6"
},
"lint-staged": {},
"msw": {
Expand Down
9 changes: 9 additions & 0 deletions public/images/category_mangoods.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/pngLogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_appliance.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_appliance.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_appliance_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_book.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_book.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_book_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_car.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_car.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_car_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_digitaldevice.png
Binary file not shown.
Binary file removed src/assets/images/category_digitaldevice_pc.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_ditigaldevice.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_ect.png
Binary file not shown.
Binary file removed src/assets/images/category_ect_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_furniture.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_furniture.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_furniture_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_game.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_game.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_game_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_mangoods.png
Binary file not shown.
9 changes: 9 additions & 0 deletions src/assets/images/category_mangoods.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/category_mangoods_pc.png
Binary file not shown.
Binary file removed src/assets/images/category_more.png
Diff not rendered.
12 changes: 12 additions & 0 deletions src/assets/images/category_more.svg
Binary file removed src/assets/images/category_more_pc.png
Diff not rendered.
Binary file removed src/assets/images/category_petgoods.png
Diff not rendered.
9 changes: 9 additions & 0 deletions src/assets/images/category_petgoods.svg

Large diffs are not rendered by default.

Binary file removed src/assets/images/category_petgoods_pc.png
Diff not rendered.
Binary file removed src/assets/images/category_sports.png
Diff not rendered.
9 changes: 9 additions & 0 deletions src/assets/images/category_sports.svg

Large diffs are not rendered by default.

Binary file removed src/assets/images/category_sports_pc.png
Diff not rendered.
Binary file removed src/assets/images/category_toy.png
Diff not rendered.
9 changes: 9 additions & 0 deletions src/assets/images/category_toy.svg

Large diffs are not rendered by default.

Binary file removed src/assets/images/category_toy_pc.png
Diff not rendered.
Binary file removed src/assets/images/category_womangoods.png
Diff not rendered.
9 changes: 9 additions & 0 deletions src/assets/images/category_womangoods.svg

Large diffs are not rendered by default.

Binary file removed src/assets/images/category_womangoods_pc.png
Diff not rendered.
34 changes: 20 additions & 14 deletions src/components/common/AlertModal/AlertModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import type { Meta, Story } from '@storybook/react'
import type { Meta, StoryObj } from '@storybook/react'
import type { AlertModalProps } from './types'
import { AlertModal } from '.'
import { AlertModal as AlertModalComponent } from '.'
import useModal from '@hooks/useModal'

export default {
argTypes: {},
component: AlertModal,
type AlertModal = typeof AlertModalComponent

const meta: Meta<AlertModal> = {
component: AlertModalComponent,
title: 'Common/AlertModal'
} as Meta<AlertModalProps>
}

const Template: Story<AlertModalProps> = args => {
export default meta

const DefaultWithHooks = (args: AlertModalProps) => {
const { openModal, closeModal, isOpen } = useModal()

return (
Expand All @@ -21,7 +24,7 @@ const Template: Story<AlertModalProps> = args => {
}}>
click
</button>
<AlertModal
<AlertModalComponent
{...args}
isOpen={isOpen}
onClose={(): void => {
Expand All @@ -31,10 +34,13 @@ const Template: Story<AlertModalProps> = args => {
</>
)
}
export const Default = Template.bind({})
Default.args = {
title: 'Title',
subTitle: 'SubTitle',
buttonContents: '확인',
hasCheckIcon: true

export const Default: StoryObj<AlertModal> = {
args: {
title: 'Title',
subTitle: 'SubTitle',
buttonContents: '확인',
hasCheckIcon: true
},
render: args => <DefaultWithHooks {...args} />
}
64 changes: 45 additions & 19 deletions src/components/common/CommonModal/CommonModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
import { Button } from '@offer-ui/react'
import type { Meta, Story } from '@storybook/react'
import type { Meta, StoryObj } from '@storybook/react'
import { useState } from 'react'
import type { CommonModalProps } from './types'
import { CommonModal } from './index'
import { CommonModal as CommonModalComponent } from './index'

export default {
component: CommonModal,
type CommonModal = typeof CommonModalComponent

const meta: Meta<CommonModal> = {
component: CommonModalComponent,
title: 'Common/CommonModal'
} as Meta<CommonModalProps>
}

export default meta

const Template: Story<CommonModalProps> = args => (
<CommonModal {...args} isOpen />
)
const DefaultWithHooks = (args: CommonModalProps) => {
const [isOpen, setIsOpen] = useState(false)

return (
<>
<button
type="button"
onClick={() => {
setIsOpen(true)
}}>
open
</button>
<CommonModalComponent
{...args}
isOpen={isOpen}
onClose={() => {
setIsOpen(false)
}}
/>
</>
)
}

export const Default = Template.bind({})
Default.args = {
description: '지금 바로 Offer에서 첫 거래를 시작해볼까요?',
hasLogo: true,
title: '부드러운 냉장고님 반가워요!',
buttons: [
<Button key="first">첫 판매하기</Button>,
<Button key="ok" styleType="ghost">
괜찮아요
</Button>
]
export const Default: StoryObj<CommonModal> = {
args: {
description: '지금 바로 Offer에서 첫 거래를 시작해볼까요?',
hasLogo: true,
title: '부드러운 냉장고님 반가워요!',
buttons: [
<Button key="first">첫 판매하기</Button>,
<Button key="ok" styleType="ghost">
괜찮아요
</Button>
]
},
render: args => <DefaultWithHooks {...args} />
}
55 changes: 27 additions & 28 deletions src/components/common/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import type { Meta, Story } from '@storybook/react'
import type { TabsProps } from './types'
import { Tab, Tabs } from './index'
import type { Meta, StoryObj } from '@storybook/react'
import { Tabs as TabsComponent, Tab } from './index'

export default {
argTypes: {
defaultTabIndex: {
control: 'number'
}
},
component: Tabs,
type Tabs = typeof TabsComponent

const meta: Meta<Tabs> = {
component: TabsComponent,
title: 'Common/Tabs'
} as Meta<TabsProps>
}

export default meta

const Template: Story<TabsProps> = args => (
<div>
<Tabs {...args}>
<Tabs.List>
<Tab>1</Tab>
<Tab>2</Tab>
<Tab>3</Tab>
</Tabs.List>
<Tabs.Panels>
<Tabs.Panel>HeadLess Tabs Content 1</Tabs.Panel>
<Tabs.Panel>HeadLess Tabs Content 2</Tabs.Panel>
<Tabs.Panel>HeadLess Tabs Content 3</Tabs.Panel>
</Tabs.Panels>
</Tabs>
</div>
)
export const Default = Template.bind({})
export const Default: StoryObj<Tabs> = {
render: args => (
<div>
<TabsComponent {...args}>
<TabsComponent.List>
<Tab>1</Tab>
<Tab>2</Tab>
<Tab>3</Tab>
</TabsComponent.List>
<TabsComponent.Panels>
<TabsComponent.Panel>HeadLess Tabs Content 1</TabsComponent.Panel>
<TabsComponent.Panel>HeadLess Tabs Content 2</TabsComponent.Panel>
<TabsComponent.Panel>HeadLess Tabs Content 3</TabsComponent.Panel>
</TabsComponent.Panels>
</TabsComponent>
</div>
)
}

0 comments on commit a8bac68

Please sign in to comment.