Skip to content

Commit

Permalink
[#191] feature: modal 스토리북 적용
Browse files Browse the repository at this point in the history
modal-root가 필요해서 preview-head.html에 추가
autodocs 전체가 모달로 덮여버리기에 modal 스토리에서는 autodocs 제거
  • Loading branch information
Seo0H committed Aug 17, 2023
1 parent 2979094 commit e83efd1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<link rel='stylesheet'
href='https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable-dynamic-subset.css'
crossOrigin='anonymous' />
crossOrigin='anonymous' />
<div id="modal-root"></div>
28 changes: 28 additions & 0 deletions src/components/modal/ChoseProductModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import ChoseProductModal from '@/components/modal/ChoseProductModal';
import searchSuggestions from '@/constant/searchSuggestions';

import type { Meta, StoryObj } from '@storybook/react';

const meta = {
title: 'Modal/ChoseProductModal',
component: ChoseProductModal,
argTypes: {
title: {
type: 'string',
},
image: { control: { type: 'file', accept: '.jpg' } },
},
} satisfies Meta<typeof ChoseProductModal>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
title: searchSuggestions[0].title as string,
image: searchSuggestions[0].image as string,
onClose: () => false,
onSubmit: () => false,
},
};
19 changes: 19 additions & 0 deletions src/components/modal/NoticeModal.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import NoticeModal from '@/components/modal/NoticeModal';

import type { Meta, StoryObj } from '@storybook/react';

const meta = {
title: 'Modal/NoticeModal',
component: NoticeModal,
} satisfies Meta<typeof NoticeModal>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
message: '오류가 발생했어요',
onClose: () => false,
},
};

0 comments on commit e83efd1

Please sign in to comment.