Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

탭 컴포넌트 구현 #24

Merged
merged 4 commits into from
Oct 31, 2023
Merged

탭 컴포넌트 구현 #24

merged 4 commits into from
Oct 31, 2023

Conversation

bomi8489
Copy link
Contributor

@bomi8489 bomi8489 commented Oct 30, 2023

📑 이슈 번호

#8

🚧 구현 내용

탭 컴포넌트를 구현 했습니다.

TabTest

🚨 특이 사항

Tab Props

interface TabProps {
  children?: React.ReactNode
}

TabItem Props

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

사용 예시

const [currentTab, setCurrentTab] = useState(0)

const tabArr = [
  { text: '스페이스', content: '스페이스 페이지', dest: '/bomiTest/tabTest' },
  { text: '댓글', content: '댓글 페이지', dest: '/bomiTest/tabTest/comment' },
  { text: '설정', content: '설정 페이지', dest: '/bomiTest/tabTest/setting' },
]

return (
  <div className="m-2">
    <Tab>
      {tabArr.map((tabItem, index) => (
        <TabItem
          key={index}
          active={currentTab === index ? true : false}
          dest={tabItem.dest}
          text={tabItem.text}
          onClick={() => setCurrentTab(index)}
        />
      ))}
    </Tab>
    {children}
  </div>
)

@bomi8489 bomi8489 added the ✨ Feature 기능 개발 label Oct 30, 2023
@bomi8489 bomi8489 added this to the 1차 스프린트 milestone Oct 30, 2023
@bomi8489 bomi8489 self-assigned this Oct 30, 2023
Copy link
Contributor

@dudwns dudwns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

탭 깔끔하네요! 고생하셨습니다 👍

Copy link
Member

@eeseung eeseung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

탭 컴포넌트는 페이지 이동이 발생하기 때문에 <Link/>를 사용하는 건 어떨까요? 지금 구조와 달라질 것 같긴 하네요..🙈 아래 코멘트 확인 부탁드립니다!

}}
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`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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-gray9 flex w-[100%] cursor-pointer items-center justify-center border-b py-4 text-sm font-bold transition ease-in-out`,

Pretendard는 빼도 될 것 같습니다!

onClick()
}}
className={cls(
active ? 'border-emerald-500' : 'border-slate-300',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
active ? 'border-emerald-500' : 'border-slate-300',
active ? 'border-emerald5' : 'border-slate3,

border에 다크 모드 적용이 필요합니다! 🌙

Comment on lines 12 to 14
onClick={() => {
onClick()
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onClick={() => {
onClick()
}}
onClick={onClick}

화살표 함수로 감싸지 않고 바로 넘겨줘도 되지 않을까요? 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모두 적용했습니다!

@bomi8489 bomi8489 merged commit 6387ef9 into develop Oct 31, 2023
1 check passed
@bomi8489 bomi8489 deleted the feature/#8/component-tab branch October 31, 2023 06:37
@bomi8489 bomi8489 restored the feature/#8/component-tab branch October 31, 2023 06:37
@bomi8489 bomi8489 deleted the feature/#8/component-tab branch October 31, 2023 06:37
@eeseung eeseung linked an issue Oct 31, 2023 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

탭 컴포넌트 구현
3 participants