Feat(hds-ui): HASHI-50 Button 컴포넌트 구현#28
Open
gyeongbibin wants to merge 5 commits into
Open
Conversation
Figma 고정 수치와 대응되는 border 계열 값은 root font-size 영향을 받지 않도록 px 또는 token을 쓰도록 명시합니다.
Figma 기준 primary/neutral variant, size, width, 상태, 접근성, v1 범위를 정의합니다.
cva 기반 primary/neutral 스타일, icon slot, disabled/loading, public type export를 추가합니다.
type 기본값, submit, loading interaction 차단, icon slot 렌더링을 검증합니다.
variant, size, full width, 탈퇴 2버튼, disabled, loading, icon, overflow 케이스를 문서화합니다.
|
🚀 Preview deployed: https://hashi-client-bykwxbjad-gyeongbinmins-projects.vercel.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Summary
Hds에 들어갈 공통 버튼 컴포넌트를 구현했습니다.
Jira: HASHI-50
📚 Tasks
HDS 공통
Button컴포넌트button을 기반으로 구현하고, 기본type은button으로 설정했습니다.variant는 v1 기준으로primary,neutral만 지원하도록 정리했습니다.size는sm,md,lg,xl네 가지로 정의하고, height만 담당하도록 설계했습니다.sm: 36pxmd: 42pxlg: 46pxxl: 52pxwidth="fit" | "full"을 지원하도록 추가했습니다.leftIcon,rightIconslot을 추가해 텍스트 버튼과 아이콘 포함 버튼을 모두 사용할 수 있도록 했습니다.Button에서 다루지 않고, 추후IconButton으로 분리하는 방향으로 정리했습니다.disabled,loading상태를 추가하고, loading 중에는 중복 클릭이 발생하지 않도록 처리했습니다.aria-busy를 연결했습니다.cva와cn을 사용해 variant, size, width class를 관리하도록 구성했습니다.Button,ButtonProps,ButtonVariant,ButtonSize,ButtonWidth를 public export에 추가했습니다.Button.spec.md에 정리해두었습니다.rem대신px또는 token을 우선 사용하도록 기준을 보강했습니다.👀 To Reviewer
지금 정리한 HDS Button 기준에서는
TextButton으로 네이밍하면 역할이 텍스트 전용 버튼처럼 좁게 해석될 수 있어 어색하다고 판단이기에 Textbutton으로 네이밍을 하기에는 button / iconbutton으로 분리하겠습니다.
초기 설계 할 때에 확장성을 고려해서
variant + emphasis로 두개의 축을 조합하는compoundVariants패턴도 고민했지만, 현재로서는 아직 조합을 늘릴 만큼 반복 패턴이 충분하지 않다고 봤습니다. 그래서 우선은primary,neutral중심의 단순한 variant 구조로 시작하는게 맞다고 봤습니다. variant 자체도 많지않다고 생각하실 수 있는데, 아래 근거를 토대로danger,cta,ghost는 바로 추가하지 않았습니다.근거
danger: Figma에삭제하기버튼 패턴은 있지만, 현재 확인된 형태는secondary-200배경에 red text가 올라간 low-emphasis destructive action에 가까웠습니다. 이걸 바로dangervariant로 올리면danger가 의미인지, 특정 시각 스타일인지 애매해질 수 있다고 판단했습니다.또한 삭제/탈퇴 같은 액션은 실제 위험도, 확인 플로우, 복구 가능 여부, 권한 처리 등이 함께 따라오는 경우가 많아서 HDS가 잡아주는 것보다는 App에서 표현하는 것이 더 적절하다고 봤습니다.
cta: 카카오톡 로그인하기 같은 단일 전환 버튼만으로 CTA를 적용하는 것이 아니라, 로그인/온보딩/예약 전환 등에서 CTA 스타일이 추가될 시 검토하는 방향으로 남겼습니다.ghost: review tone(프로필삭제) 도 아직 반복 근거가 부족해서 포함하지 않았습니다. 대신 추후 어떤 조건에서 추가할지Button.spec.md에 정리해두었습니다.그 외
size는 height만 담당하도록 했는데 이부분은 같은 height 안에서도 typography, padding, layout이 다르게 쓰이는 케이스가 있어서, size에 묶을 수 없었습니다..추가적으로 height 값이 많이 분산되어 있어서 모든 케이스를 묶지는 못했습니다. cn으로 처리해야할 것같습니다. 디자인과 협의하여 45px/51px -> 46px/52px로 수정 부탁드릴 예정입니다.
잘못 구현된 부분있으면 바로 말씀주세요..
p.s.
한가지 건의 드리고 싶은 사항은 글로벌에
html { font-size: 62.5%; }적용하는 것 어떻게 생각하시나요 ?📸 Screenshot