Skip to content

Commit

Permalink
feat: #8 - 탭 컴포넌트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
권기범 authored and 권기범 committed Oct 31, 2023
1 parent b101732 commit 2d5db14
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/components/Tab/Tab.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/Tab/TabItem.tsx

This file was deleted.

9 changes: 9 additions & 0 deletions src/components/common/Tab/Tab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
interface TabProps {
children?: React.ReactNode
}

const Tab = ({ children }: TabProps) => {
return <div className="flex transition ease-in-out">{children}</div>
}

export default Tab
24 changes: 24 additions & 0 deletions src/components/common/Tab/TabItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { cls } from '@/utils'

interface TabItemProps {
active?: boolean
text?: string
onClick: (_e?: React.MouseEvent<HTMLButtonElement>) => void
}

const TabItem = ({ active, text, onClick }: TabItemProps) => {
return (
<div
onClick={() => {
onClick()
}}
className={cls(
active ? 'border-emerald-500' : 'border-slate-300',
`text-gray9 flex w-[100%] cursor-pointer items-center justify-center border-b py-4 font-['Pretendard'] text-sm font-bold transition ease-in-out`,
)}>
{text}
</div>
)
}

export default TabItem

0 comments on commit 2d5db14

Please sign in to comment.