Skip to content

Conversation

@HamBeomJoon
Copy link
Contributor

@HamBeomJoon HamBeomJoon commented Jan 25, 2026

📌 작업 내용

PrezelChip 구현

분기처리

  • Feedback = BAD일 때 -> 붉은색
  • Feedback = DEFAULT일때 -> Interaction으로 DEFAULT, ACTIVE, DISABLED 분기처리

🧩 관련 이슈


📸 스크린샷

  • PrezelChip
스크린샷 2026-01-26 01 44 37
  • IconChip
스크린샷 2026-01-26 01 44 45
  • Custom Chip
스크린샷 2026-01-26 01 44 51

📢 논의하고 싶은 내용

  1. 우선, 라이트테마에 맞게 설정했습니다. (피그마에 역시 안맞는 색상들이 좀 있어서,,,)
  2. 전반적으로 PrezelButton 코드랑 비슷하게 했기때문에 읽기 쉬울거라 예상합니다. 오버로딩쪽봐주세요

Summary by CodeRabbit

  • 신규 기능

    • 확장된 Chip 컴포넌트 추가: 타입(채움/외곽), 크기, 상호작용 및 피드백 상태 지원
    • 텍스트·아이콘·아이콘 전용 구성 가능(텍스트/아이콘 최소 하나 요구) 및 전용 레이아웃/간격 처리
    • 컨테이너·콘텐츠 색상 오버라이드(커스텀 색상) 및 스타일 설정 지원
    • 간편 아이콘 전용 컴포넌트(PrezelIconChip) 추가
  • 디자인/미리보기

    • 다양한 변형·크기·상호작용·피드백을 시연하는 다수의 미리보기 화면 추가

✏️ Tip: You can customize this high-level summary in your review settings.

`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` 추가
@HamBeomJoon HamBeomJoon self-assigned this Jan 25, 2026
@HamBeomJoon HamBeomJoon added the ✨ feat 새로운 기능 추가 또는 기존 기능 확장 label Jan 25, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

이 PR은 Prezel 디자인 시스템에 칩 컴포넌트를 추가합니다. 공개 컴포넌트 PrezelChip(텍스트·아이콘 병행 또는 아이콘 전용, 색상 오버라이드 가능)과 PrezelIconChip을 도입하고, PrezelChipType/Interaction/Feedback/Size 열거형 및 PrezelChipStyle·PrezelChipColors를 추가했습니다. 내부적으로 모양 선택, 경계선 계산, 텍스트 스타일, 컨테이너·콘텐츠 색상 결정, 패딩·아이콘 크기 유틸리티와 관련 프리뷰들이 구현되었습니다.

Possibly related PRs

  • PR 18: 디자인 토큰(모양, 여백, 스트로크 등)과 PrezelTheme 로컬 값들을 도입하여 칩 스타일 함수들이 해당 프리미티브를 참조합니다.
  • PR 25: IconSource 및 DrawableIcon 아이콘 추상화 도입과 관련되며, 새 칩 컴포넌트들이 동일한 아이콘 처리 방식을 사용합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목 '구현'이 명확하게 PrezelChip 구현이라는 주요 변경사항을 직결적으로 요약하고 있습니다.
Description check ✅ Passed PR 설명이 작업 내용, 관련 이슈, 스크린샷, 논의사항을 포함하여 템플릿 구조를 충족하고 있습니다.
Linked Issues check ✅ Passed PrezelChip과 PrezelIconChip 구현 요구사항이 모두 충족되었으며, Feedback/Interaction 상태별 스타일링도 구현되었습니다.
Out of Scope Changes check ✅ Passed 추가된 모든 파일이 PrezelChip 관련 컴포넌트, 스타일, 미리보기로 이슈 #27의 범위 내에 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

`PrezelChip` 컴포저블 내부의 복잡한 색상 및 테두리 결정 로직을 별도의 private 함수로 분리하여 가독성을 개선했습니다.

* `resolveChipBorder`, `resolveChipContainerColor`, `resolveChipContentColor` 함수 추가
* 커스텀 색상이 지정된 경우의 테두리 처리 로직 수정 (0.dp 대신 null 반환)
* 불필요한 import 제거 및 코드 구조 정리
Copy link
Member

@moondev03 moondev03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

린트도 확인해주세요 :)

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()`로 일원화
* 코드 스타일 및 가독성을 위한 전반적인 리팩터링 수행
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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) 패턴을 사용하고, 두 번째 오버로드에서는 중첩 조건문 패턴을 사용합니다. 코드 일관성을 위해 동일한 패턴으로 통일하는 것을 권장합니다.

`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` 변수의 선언 위치를 파일 상단으로 이동하여 코드 가독성을 개선했습니다.
@HamBeomJoon HamBeomJoon merged commit 97f6dc5 into develop Jan 26, 2026
2 checks passed
@HamBeomJoon HamBeomJoon deleted the feat/#27-prezel-chip branch January 26, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat 새로운 기능 추가 또는 기존 기능 확장

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PrezelChip 구현

3 participants