diff --git a/apps/docs/src/stories/Tab.stories.tsx b/apps/docs/src/stories/Tab.stories.tsx index 57623847..5cba3990 100644 --- a/apps/docs/src/stories/Tab.stories.tsx +++ b/apps/docs/src/stories/Tab.stories.tsx @@ -5,15 +5,45 @@ const meta = { title: 'Components/Tab', component: Tab, tags: ['autodocs'], + parameters: { + docs: { + description: { + component: '동일한 위계의 요소를 그룹화하여 화면이동 없이 빠르게 탐색합니다.', + }, + }, + }, args: { tabItems: ['Tab1', 'Tab2', 'Tab3'], selectedInitial: 'Tab1', translator: { Tab1: '탭1', Tab2: '탭2', Tab3: '탭3' }, }, argTypes: { - style: { control: 'radio', options: ['primary', 'secondary'] }, - size: { control: 'radio', options: ['sm', 'md', 'lg'] }, - selectedInitial: { control: 'select', options: ['Tab1', 'Tab2', 'Tab3'] }, + tabItems: { + description: '여러 Tab 항목을 전달합니다.', + table: { type: { summary: 'T[]' } }, + }, + selectedInitial: { + control: 'select', + options: ['Tab1', 'Tab2', 'Tab3'], + description: 'Tab의 초기 선택 값을 설정합니다.', + table: { type: { summary: 'T (optional)' } }, + }, + translator: { + description: 'Tab 항목의 텍스트를 원하는 컴포넌트로 변경합니다.', + table: { type: { summary: 'Record' } }, + }, + style: { + control: 'inline-radio', + options: ['primary', 'secondary'], + description: 'Tab의 스타일을 설정합니다.', + table: { type: { summary: 'primary | secondary' } }, + }, + size: { + control: 'inline-radio', + options: ['sm', 'md', 'lg'], + description: 'Tab의 크기를 설정합니다.', + table: { type: { summary: 'sm | md | lg' } }, + }, }, } as Meta; diff --git a/packages/ui/Tab/Tab.tsx b/packages/ui/Tab/Tab.tsx index 30b0333f..87d4c87e 100644 --- a/packages/ui/Tab/Tab.tsx +++ b/packages/ui/Tab/Tab.tsx @@ -1,4 +1,4 @@ -import type { ReactNode} from 'react'; +import type { ReactNode } from 'react'; import { useState } from 'react'; import * as S from './style.css'; import { createTabItemVariant, createTabVariant } from './utils'; @@ -30,21 +30,24 @@ function Tab(props: TabProps) { }; return ( -
+
{tabItems.map((item) => { - const isSelected = selected === item ? 'selected' : ''; + const isSelected = selected === item; return (
-
+
); })} @@ -53,3 +56,5 @@ function Tab(props: TabProps) { } export default Tab; + +Tab.displayName = 'Tab';