-
Notifications
You must be signed in to change notification settings - Fork 1
PrezelChip 구현 #41
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
base: develop
Are you sure you want to change the base?
PrezelChip 구현 #41
Conversation
`PrezelChip` 및 `PrezelIconChip` 컴포넌트를 새롭게 추가했습니다. * `PrezelChipType` (FILLED, OUTLINED), `PrezelChipSize` (SMALL, REGULAR) 등 다양한 스타일 옵션 제공 * `PrezelChipInteraction` (DEFAULT, ACTIVE, DISABLED) 및 `PrezelChipFeedback` (DEFAULT, BAD) 상태 지원 * 아이콘 유무 및 텍스트 포함 여부에 따른 유연한 레이아웃 구성 * 컴포넌트별 테마 적용 및 스타일링 로직(`PrezelChipStyle.kt`) 분리 * 미리보기를 위한 `PrezelChipPreview` 유틸리티 추가
PrezelChip 컴포넌트에서 외부로부터 직접 색상을 주입받을 수 있도록 개선하고, 이를 확인하기 위한 커스텀 프리뷰 코드를 추가했습니다. * `PrezelChip` 파라미터에서 `containerColor`와 `contentColor` 타입을 `PrezelColors`에서 `Color?`로 변경 및 기본값(null) 설정 * 외부 색상 주입 시 테두리(border)를 투명하게 처리하도록 로직 수정 * 다양한 색상 조합을 테스트할 수 있는 `PrezelCustomChipPreview.kt` 추가
Walkthrough이 풀 리퀘스트는 Prezel 디자인 시스템에 칩 컴포넌트를 추가합니다. Public API로 Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
`PrezelChip` 컴포저블 내부의 복잡한 색상 및 테두리 결정 로직을 별도의 private 함수로 분리하여 가독성을 개선했습니다. * `resolveChipBorder`, `resolveChipContainerColor`, `resolveChipContentColor` 함수 추가 * 커스텀 색상이 지정된 경우의 테두리 처리 로직 수정 (0.dp 대신 null 반환) * 불필요한 import 제거 및 코드 구조 정리
moondev03
left a comment
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.
린트도 확인해주세요 :)
| containerColor: Color? = null, | ||
| contentColor: Color? = null, |
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.
Color를 nullable로 처리하기보다는 Color.Unspecified를 사용하는 편이 코드 가독성 측면에서 더 깔끔해 보입니다.
또한 기본 Material3 컴포넌트의 설계 방식과도 일관성을 유지할 수 있을 것 같아요.
| PrezelChipSize.SMALL -> 12.dp | ||
| PrezelChipSize.REGULAR -> 14.dp |
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.
| Surface( | ||
| modifier = modifier, | ||
| shape = prezelChipShape(chipSize), | ||
| color = resolvedContainerColor, | ||
| border = resolvedBorder, | ||
| ) { | ||
| CompositionLocalProvider( | ||
| LocalTextStyle provides prezelChipTextStyle(chipSize), | ||
| LocalContentColor provides resolvedContentColor, | ||
| ) { | ||
| Row( | ||
| modifier = Modifier.padding(prezelChipContentPadding(size = chipSize, onlyIcon = hasIcon && !hasText)), | ||
| horizontalArrangement = Arrangement.Center, | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| ) { | ||
| PrezelChipIcon(icon = icon, size = chipSize) | ||
|
|
||
| if (!hasText) return@Row | ||
| if (hasIcon) { | ||
| val spacing = if (chipSize == PrezelChipSize.REGULAR) PrezelTheme.spacing.V4 else PrezelTheme.spacing.V2 | ||
| Spacer(modifier = Modifier.width(width = spacing)) | ||
| } | ||
|
|
||
| Text(text = text) | ||
| } | ||
| } | ||
| } |
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.
Line 27 ~와 중복 코드인 것 같아요.
혹시 resolvedXxx가 때문이라면 CompositionLocal을 활용해주세요
| } | ||
|
|
||
| @Immutable | ||
| data class PrezelChipStyle( |
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.
Style 정보를 바탕으로 contentColor, textStyle 같은 파생 값을 계산해야 하는데, 코드를 보다 보니 이런 로직들은 최상위 함수로 분리하기보다 PrezelChipStyle 내부의 함수로 묶어두는 편이 더 자연스럽고 코드도 간결해질 것 같아요.

📌 작업 내용
PrezelChip 구현
분기처리
🧩 관련 이슈
📸 스크린샷
📢 논의하고 싶은 내용
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.