-
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
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이 PR은 Prezel 디자인 시스템에 칩 컴포넌트를 추가합니다. 공개 컴포넌트 PrezelChip(텍스트·아이콘 병행 또는 아이콘 전용, 색상 오버라이드 가능)과 PrezelIconChip을 도입하고, PrezelChipType/Interaction/Feedback/Size 열거형 및 PrezelChipStyle·PrezelChipColors를 추가했습니다. 내부적으로 모양 선택, 경계선 계산, 텍스트 스타일, 컨테이너·콘텐츠 색상 결정, 패딩·아이콘 크기 유틸리티와 관련 프리뷰들이 구현되었습니다. 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.
린트도 확인해주세요 :)
...re/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt
Outdated
Show resolved
Hide resolved
...signsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChipStyle.kt
Outdated
Show resolved
Hide resolved
...re/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt
Show resolved
Hide resolved
...signsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChipStyle.kt
Show resolved
Hide resolved
PrezelChip의 사이즈별 아이콘 크기를 다음과 같이 수정했습니다. * SMALL: 12.dp -> 14.dp * REGULAR: 14.dp -> 16.dp
`PrezelChip` 컴포넌트의 `containerColor` 및 `contentColor` 파라미터 기본값을 `null`에서 `Color.Unspecified`로 변경했습니다.
`PrezelChipStyle` 내부로 칩 스타일 관련 로직을 캡슐화하고 구성 방식을 개선했습니다. * `PrezelChipStyle` 클래스 내부에 `shape`, `borderStroke`, `textStyle` 등의 스타일 계산 로직을 메서드로 통합 * `PrezelChipColors` 데이터 클래스 및 `LocalPrezelChipColors` 추가를 통한 색상 관리 구조 개선 * `PrezelChip` 컴포넌트의 가독성 향상을 위해 불필요한 색상 결정 로직(resolve functions) 제거 및 내부 구조 단순화 * 아이콘 크기 계산 방식을 `PrezelChipStyle.iconSize()`로 일원화 * 코드 스타일 및 가독성을 위한 전반적인 리팩터링 수행
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt`:
- Around line 144-145: PrezelTheme이 중첩 호출되어 두 번 래핑되고 있으니 중복된 호출 중 하나를 제거하여 단일
PrezelTheme 블록만 남기세요; PrezelChip.kt 내의 PrezelTheme { PrezelTheme { ... } } 구조를
찾아 바깥 또는 안쪽 하나를 삭제해 중복을 없애고 레이아웃/스코프 영향이 없도록 남은 PrezelTheme 블록이 자식 컴포저블을 모두
포함하도록 정리하세요.
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChipStyle.kt`:
- Around line 178-184: The passed-in containerColor/contentColor parameters are
never consumed because LocalPrezelChipColors is provided but never read; update
the PrezelChip implementation so the provided colors are actually used — either
read LocalPrezelChipColors.current where colors are needed (replace direct calls
to style.containerColor() and style.contentColor() with reads that prefer the
provided values) or alter the style usage to accept overrides from the
parameters; specifically ensure the composition provider of
LocalPrezelChipColors(PrezelChipColors(containerColor, contentColor)) is paired
with a consumer (e.g., when computing final colors replace calls to
style.containerColor() and style.contentColor() with logic that first checks
LocalPrezelChipColors.current and falls back to style.* methods) so the
parameters are not ignored.
♻️ Duplicate comments (1)
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt (1)
27-67: 두 번째 오버로드와의 중복 코드첫 번째 오버로드(Lines 27-67)와 두 번째 오버로드(Lines 69-124) 간에 상당한 중복 코드가 존재합니다. 공통 로직을 추출하여 내부 컴포저블로 분리하거나, 첫 번째 오버로드가 두 번째를 호출하도록 리팩터링하면 유지보수성이 향상됩니다.
🧹 Nitpick comments (2)
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt (2)
38-38: Destructuring 대신 직접 프로퍼티 접근 권장Line 38에서
val (_, chipSize, _, _) = style로 destructuring을 사용하고 있지만, 두 번째 오버로드(Line 112)에서는style.size로 직접 접근합니다. 일관성을 위해 직접 프로퍼티 접근 방식으로 통일하는 것이 좋습니다.♻️ 제안된 수정
- val (_, chipSize, _, _) = style ... - val spacing = if (chipSize == PrezelChipSize.REGULAR) PrezelTheme.spacing.V4 else PrezelTheme.spacing.V2 + val spacing = if (style.size == PrezelChipSize.REGULAR) PrezelTheme.spacing.V4 else PrezelTheme.spacing.V2
110-119: 제어 흐름 패턴 불일치첫 번째 오버로드(Lines 57-63)에서는 조기 반환(
if (!hasText) return@Row) 패턴을 사용하고, 두 번째 오버로드에서는 중첩 조건문 패턴을 사용합니다. 코드 일관성을 위해 동일한 패턴으로 통일하는 것을 권장합니다.
...re/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt
Outdated
Show resolved
Hide resolved
...signsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChipStyle.kt
Outdated
Show resolved
Hide resolved
`PrezelChip`의 내부 구현을 `PrezelChipImpl`로 통합하고, 스타일 계산 로직에서 `LocalPrezelChipColors`를 직접 참조하도록 개선했습니다. * `PrezelChipStyle` 내 `borderStroke`, `containerColor`, `contentColor`가 `LocalPrezelChipColors`를 참조하여 색상을 결정하도록 수정 * `PrezelChip`과 `PrezelCustomChip`의 공통 로직을 `PrezelChipImpl`로 추출하여 중복 제거 * `PrezelChipStyle`에 `iconTextSpacing()` 메서드를 추가하여 칩 사이즈에 따른 간격 로직 분리 * 미사용 코드 정리 및 Preview 레이아웃 수정 (불필요한 중복 Theme 래퍼 및 간격 제거)
`PrezelChip`의 개별 색상 파라미터(`containerColor`, `contentColor`)를 `PrezelChipColors` 객체를 사용하는 `customColors` 파라미터로 통합했습니다. * `PrezelChip` 함수 시그니처 수정 및 `CompositionLocalProvider` 로직 변경 * `PrezelCustomChipPreview` 내 파라미터 호출부 수정 * 불필요한 import 제거
* 불필요한 `PrezelChipImpl` 내부 함수를 제거하고 `PrezelChip`으로 로직을 통합했습니다. * `CompositionLocalProvider`를 사용하는 오버로딩 함수가 통합된 `PrezelChip`을 호출하도록 수정했습니다.
`PrezelChipColors` 클래스와 `LocalPrezelChipColors` 변수의 선언 위치를 파일 상단으로 이동하여 코드 가독성을 개선했습니다.
📌 작업 내용
PrezelChip 구현
분기처리
🧩 관련 이슈
📸 스크린샷
📢 논의하고 싶은 내용
Summary by CodeRabbit
신규 기능
디자인/미리보기
✏️ Tip: You can customize this high-level summary in your review settings.