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

feat: 토글바 컴포넌트 #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: 토글바 컴포넌트 #34

wants to merge 1 commit into from

Conversation

Youjiiin
Copy link
Collaborator

No description provided.

@Youjiiin Youjiiin requested a review from XionWCFM January 10, 2025 13:49
@Youjiiin Youjiiin self-assigned this Jan 10, 2025
@Youjiiin Youjiiin linked an issue Jan 10, 2025 that may be closed by this pull request
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 100% 14 / 14
🔵 Statements 100% 14 / 14
🔵 Functions 100% 0 / 0
🔵 Branches 100% 3 / 3
File CoverageNo changed files found.
Generated in workflow #24 for commit dd4930d by the Vitest Coverage Report Action

<button
onClick={() => handleToggle("created")}
className={cn(
selected === "created" ? "text-gray-500" : "text-gray-300",
Copy link
Collaborator

Choose a reason for hiding this comment

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

이렇게 관리되면 실제 상태와 디자인간의 불일치가 발생할 수 있어보여요

  • 추가로 요런 토글컴포넌트 같은 경우는 저희 패키지에 ToggleButtonGroup이랑 ToggleButton 컴포넌트 사용하면 구현 가능합니다!
export default function Page() {
  const [value, setValue] = useState<string>("created");
  return (
    <ToggleButtonGroup value={value} onChange={(value) => setValue(value ?? "created")}>
      <Flex className=" gap-x-4">
        <ToggleButton
          value="updated"
          className={cn(" text-gray-300 data-[state=selected]:text-gray-500")}
        >
          updated
        </ToggleButton>
        <ToggleButton
          value="created"
          className={cn(" text-gray-300 data-[state=selected]:text-gray-500")}
        >
          created
        </ToggleButton>
      </Flex>
    </ToggleButtonGroup>
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Toggle Bar 구현
2 participants