Skip to content

Commit

Permalink
docs: Overflow 시 테스트 추가, height 타입 테이블에서 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
seocylucky committed Oct 30, 2024
1 parent 3a8416d commit 3a2c4e5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/Snackbar/Snackbar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ function App() {
4. Snackbar를 닫을 시, info 타입일 때는 `드래그`, error 타입일 때는 `X 버튼`을 클릭하여 Snackbar를 닫을 수 있습니다.

<Canvas of={SnackbarStories.CloseTest} />

5. Snackbar는 `최대 두 줄까지` 입력되며, 두 줄을 넘어설 시, `ellipsis` 처리됩니다.

<Canvas of={SnackbarStories.OverflowTest} />
24 changes: 21 additions & 3 deletions src/components/Snackbar/Snackbar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Meta, StoryObj } from '@storybook/react';

import { BoxButton } from '../BoxButton';

import { Snackbar } from './Snackbar';
import { SnackbarProps } from './Snackbar.type';
import { SnackbarProvider } from './SnackbarProvider';
Expand Down Expand Up @@ -37,16 +36,16 @@ const meta: Meta<SnackbarProps> = {
control: 'text',
description: 'Snackbar의 내용 (메시지)',
},
id: { table: { disable: true } },
onClose: { table: { disable: true } },
isClosing: { table: { disable: true } },
$heightType: { table: { disable: true } },
},
};

export default meta;
type Story = StoryObj<SnackbarProps>;

const SnackbarComponent = (args: Partial<SnackbarProps>) => {
const SnackbarComponent = (args: SnackbarProps) => {
const { snackbar } = useSnackbar();

const addSnackbar = () => {
Expand Down Expand Up @@ -123,3 +122,22 @@ export const CloseTest: Story = {
position: 'center',
},
};

export const OverflowTest: Story = {
render: (args) => (
<SnackbarProvider>
<h3>두 줄 이상 입력 시</h3>
<br />
<div style={{ display: 'flex', gap: '20px' }}>
<SnackbarComponent {...args} type="info" />
<SnackbarComponent {...args} type="error" />
</div>
</SnackbarProvider>
),
args: {
message:
'최대 2줄 입력 가능합니다. 입력 값이 넘칠 시, ellipsis 처리됩니다. 최대 2줄 입력 가능합니다. 입력 값이 넘칠 시, ellipsis 처리됩니다.',
width: '350px',
position: 'center',
},
};

0 comments on commit 3a2c4e5

Please sign in to comment.