refactor: JDS Kbd 컴포넌트 vanilla-extract 마이그레이션 #439
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ccconac
left a comment
There was a problem hiding this comment.
간단하게 코멘트 남겨 두었습니다~
다른 PR과 공통되는 것들도 많아서 참고 부탁드립니다. 수고하셨습니다!
| import { kbd } from "./kbd.css"; | ||
| import type { KbdProps } from "./kbd.types"; | ||
|
|
||
| export const Kbd = ({ |
There was a problem hiding this comment.
#438 (comment) 잊은 게 있어서 추가적으로 코멘트 남깁니다!
기존에는 Code 컴포넌트가 forwardRef를 지원하지 않았는데요. 다른 JDS 컴포넌트들과의 인터페이스 통일성 측면에서도 그렇고, 소비자가
<code>태그의 ref를 활용해 DOM 제어를 시도할 가능성을 배제할 수 없어 보여요. 때문에 원시 컴포넌트로서의 활용성을 높이기 위해 forwardRef 적용이 필요해 보입니다.
같은 맥락으로 참고 부탁드려요.
There was a problem hiding this comment.
2cfbc06 적용했습니다!! 옵셔널로 선언되어있던 aria-label은 kbd의 props에 포함되므로 제거했습니다 😊
|
|
||
| export const kbd = recipe({ | ||
| base: { | ||
| boxSizing: "initial", |
There was a problem hiding this comment.
해당 스타일 속성이 기존 키보드 컴포넌트에 선언되어 있었는데, 이 때문에 높이가 실제 렌더 높이를 보장하지 않아서 제거하는 것이 좋아 보여요.
아마 당시에 border가 영역을 차지하면서 padding이 좁아지는 것처럼 보이는 이슈 때문에 이렇게 해결했었던 듯한데, 지금 보니 좋은 방식이 아닌 것 같고 제거해도 피그마와 시각적인 차이가 없어 코멘트 남깁니다.
| text: 6, | ||
| }; | ||
|
|
||
| export const typographyMap: Record<KbdType, Record<KbdSize, string>> = { |
There was a problem hiding this comment.
(참고) 이전에 작업되어 있던 내용이지만, 최근에 토큰이 자주 변경되면서 이슈가 우려되어 남깁니다.
타입이 string으로만 선언되어 있어 토큰명이 변경되어도 컴파일러가 이슈를 잡을 수 없을 걸로 보여요.
엄격하게 satisfies로 객체 리터럴 타입을 보존하는 방법도 있겠네요.
There was a problem hiding this comment.
5269403 tokens/textStyles.css.ts의 상수값을 사용하여 satisfies 적용해보았습니다!
| defaultVariants: { | ||
| type: "key", | ||
| size: "md", | ||
| muted: false, | ||
| }, |
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 54 minutes and 45 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
개요Kbd 컴포넌트가 Emotion 기반 스타일링 시스템에서 vanilla-extract 기반 시스템으로 완전 마이그레이션됩니다. 새로운 타입 구조, vanilla-extract recipe 스타일 시스템, forwardRef 기반 컴포넌트 구현, 그리고 문서 업데이트가 포함됩니다. 변경 사항Kbd 컴포넌트 vanilla-extract 마이그레이션
🎯 코드 리뷰 난이도🎯 3 (보통) | ⏱️ ~25분
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| import { vars } from "../../tokens/vars.css"; | ||
| import { pxToRem } from "../../utils/cssUnit"; |
💡 작업 내용
💡 자세한 설명
kbdPaddingXMap 분리
기존
kbdSizeMap은 모든 size에서paddingX: 6을 가지고 있어, 사실상 size가 아닌 type별 속성이었지만, Figma 확인 결과 function 타입의 paddingX는 4px, 나머지는 6px로 size가 아닌 type에 의해 결정됨을 확인하여kbdPaddingXMap을 별도로 추출했습니다.스타일 변경
Kbd 컴포넌트의 배경색이 삭제되었습니다. 디자이너님께 질문드려 확인한 사항이며, 변경된 스타일에 맞게 배경색 제거 후 내부 텍스트 색상 변경했습니다!
📗 참고 자료 (선택)
📢 리뷰 요구 사항 (선택)
✅ 셀프 체크리스트
closes #436
Summary by CodeRabbit
릴리스 노트