-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(design-system): toggle component 구현 #17
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
Changes from all commits
620626b
c4e315d
715df47
54c4ea8
6e76fe4
6724bce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export { default as Button } from './button/Button'; | ||
| export { Switch } from './switch/switch'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import * as React from 'react'; | ||
| import * as SwitchPrimitive from '@radix-ui/react-switch'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| function Switch({ | ||
| className, | ||
| ...props | ||
| }: React.ComponentProps<typeof SwitchPrimitive.Root>) { | ||
| return ( | ||
| <div className="text-main600"> | ||
| <SwitchPrimitive.Root | ||
| data-slot="switch" | ||
| className={cn( | ||
| 'data-[state=checked]:bg-main400 data-[state=unchecked]:bg-gray200 focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 shadow-xs peer inline-flex h-[1.15rem] h-[2rem] w-[4rem] shrink-0 items-center rounded-full border border-transparent outline-none transition-all focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain디자인 토큰/유틸 클래스 존재 여부 확인 요청(shadow-xs, main400 등)
다음 스크립트로 설정 파일에서 토큰 정의를 찾아볼 수 있습니다(리포지토리 루트에서 실행). 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Tailwind 설정 파일 탐색 =="
fd -HI 'tailwind.config*' -t f
echo "== 색상/그림자 토큰 정의 검색 =="
# colors에 main400/gray200/input/ring 등이 정의되어 있는지
rg -nP 'colors\s*:\s*{[^}]*\b(main400|gray200|input|ring)\b' -C2 --hidden
echo "== 임의 클래스 사용 여부 점검(shadow-xs) =="
rg -n '\bshadow-xs\b' --hidden
echo "== v4 @source 적용 여부 재확인 =="
rg -n '@source' packages/design-system -C1 --hiddenLength of output: 272 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Tailwind 설정 파일 (apps/extension/tailwind.config.ts) 처음 200행 =="
sed -n '1,200p' apps/extension/tailwind.config.ts
echo "== 메인 색상 토큰(main400) 검색 =="
rg -n -C3 'main400' apps/extension/tailwind.config.ts || true
echo "== gray200 검색 =="
rg -n -C3 'gray200' apps/extension/tailwind.config.ts || true
echo "== input 색상 토큰(input) 검색 =="
rg -n -C3 'input' apps/extension/tailwind.config.ts || true
echo "== ring 색상 토큰(ring) 검색 =="
rg -n -C3 'ring' apps/extension/tailwind.config.ts || true
echo "== 그림자 유틸(shadow-xs) 검색 =="
rg -n -C3 'shadow-xs' apps/extension/tailwind.config.ts || trueLength of output: 991 Tailwind 설정에 커스텀 토큰·유틸이 정의되어 있지 않습니다 조치 사항:
🤖 Prompt for AI Agents
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 부분은 잘 적용 되는 거죠?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 4714 🏁 Script executed: Length of output: 3302 🏁 Script executed: Length of output: 6457 🏁 Script executed: Length of output: 151 @constantly-dev 부분적으로만 잘 적용됩니다! 분석 결과: ✅ 잘 작동하는 클래스들:
❌ 작동하지 않는 클래스들:
해결 방법: @theme {
/* 기존 색상들... */
/* 추가 필요한 시맨틱 토큰들 */
--color-background: #ffffff;
--color-foreground: #111111;
--color-input: #f1f1f5;
--color-ring: #54d19d;
--color-primary-foreground: #ffffff;
}
/* 그림자 유틸리티 추가 */
@utility shadow-xs {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}현재 상태에서는 토글 컴포넌트가 렌더링되지만 일부 스타일링(포커스 링, 다크모드 배경, 그림자)이 누락될 것입니다. 분석하는 토끼 🧠 Learnings used |
||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| <SwitchPrimitive.Thumb | ||
| data-slot="switch-thumb" | ||
| className={cn( | ||
| 'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-[1.6rem] rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[2.1rem] data-[state=unchecked]:translate-x-[0.1rem]' | ||
| )} | ||
| /> | ||
| </SwitchPrimitive.Root> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export { Switch }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| @import '@pinback/tailwind-config/shared-styles.css'; | ||
|
|
||
| @source "./src"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 최고 👍 |
||
|
|
||
| @custom-variant dark (&:is(.dark *)); | ||
|
|
||
| :root { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
ref 미전달 — 포커스 관리/폼 연동에 영향, forwardRef로 전환 권장
디자인 시스템 입력형 컴포넌트는 보통 ref 전달을 지원해야 포커스 트랩, 포커스 이동, 폼 라이브러리(react-hook-form 등)와 매끄럽게 동작합니다. 현재 일반 함수 컴포넌트로 정의되어 ref가 전달되지 않습니다.
forwardRef로 전환해 주세요.h-[1.15rem] h-[2rem]도 함께 정리했습니다(마지막 값이 유효하지만 혼란을 야기).peer클래스는 현재 사용되지 않아 제거했습니다.motion-reduce:transition-none추가를 제안합니다.Also applies to: 12-18, 20-26, 31-31
🤖 Prompt for AI Agents