Skip to content

Conversation

@LeeYeJi546
Copy link

@LeeYeJi546 LeeYeJi546 commented Jan 3, 2026

✨ PR 유형

📷 스크린샷 or 영상(UI 변경 시)

스크린샷 2026-01-04 오전 3 14 12 스크린샷 2026-01-04 오전 3 14 16

🛠️ 작업내용

커밋 히스토리

  • [feat] ChipButton 컴포넌트 제작: ChipButton 기본 틀 제작

📋 추후 진행 상황

📌 리뷰 포인트

  • isSelected 상태관리

✅ Checklist

PR이 다음 요구 사항을 충족하는지 확인해주세요!!!

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a customizable ChipButton UI component with three size options (small, medium, large).
    • Supports visual selection state with automatic color changes based on selection.
    • Configured through convenient modifiers for seamless integration.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new SwiftUI ChipButton component with environment-based configuration infrastructure. The component renders as a capsule button with selection state handling, accompanied by environment keys, ViewModifier helpers, and a size utility enum that defines three predefined button sizes with corresponding heights and fonts.

Changes

Cohort / File(s) Summary
ChipButton Component
ChipButton.swift
Introduces ChipButton struct conforming to View. Renders a Button with a Capsule background that changes color based on selection state (primary400 when selected, primary100 otherwise). Delegates content presentation to private ChipButtonContent presenter. Accepts title, isSelected flag, and action closure. Reads chipButtonSize from environment for responsive styling. Includes SwiftUI preview with toggleable selection state.
Environment Configuration
ChipButtonEnvironment.swift
Adds ChipButtonSizeKey (default: .medium) and ChipButtonIsSelectedKey (default: false) environment keys. Extends EnvironmentValues with computed properties chipButtonSize and chipButtonIsSelected for ergonomic environment value access.
Modifiers & Protocol
ChipButtonModifiers.swift
Defines AnyChipButton protocol to tag chip button views. Introduces ChipButtonSizeModifier and ChipButtonIsSelectedModifier ViewModifiers that inject size and selection state into the environment. Provides extension on AnyChipButton with buttonSize(_:) and selected(_:) helper methods for fluent composition.
Size Utilities
ChipButtonSize.swift
Adds ChipButtonSize enum with three cases: small, medium, large. Provides computed properties: height (returns 25, 29, 32 respectively) and font (returns bold AppFont variants: .caption2, .caption1, .footnote).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

feat

Poem

🐰 A button in a capsule fair,
With sizes small, medium, and large to spare,
Selected states in colors bright,
Environment keys align just right!
SwiftUI magic, hopping with glee!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: introduction of a new ChipButton component with a concise, single-sentence format.
Description check ✅ Passed The PR description includes most required template sections with screenshots, commit details, review points, and checklist verification, though 추후 진행 상황 (future progress) section lacks content.
✨ Finishing touches
  • 📝 Generate docstrings

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

@LeeYeJi546 LeeYeJi546 marked this pull request as ready for review January 3, 2026 18:14
Copy link

@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: 5

🧹 Nitpick comments (2)
AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButton.swift (1)

35-45: Consider adding accessibility support.

The button lacks accessibility labels, hints, or traits. For better user experience with VoiceOver and other assistive technologies, consider adding accessibility modifiers.

🔎 Example implementation
 var body: some View {
     Button(action: action) {
             ChipButtonContent(
                 title: title,
                 size: size,
                 isSelected: isSelected
             )
             .equatable()
         }
     .buttonStyle(.plain)
+    .accessibilityLabel(title)
+    .accessibilityAddTraits(isSelected ? [.isSelected] : [])
 }
AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonModifiers.swift (1)

43-45: Add documentation for selected() modifier.

The buttonSize(_:) method has documentation (lines 37-38), but selected(_:) is missing equivalent documentation describing its purpose and parameters.

🔎 Proposed documentation
+/// 버튼 선택 상태 설정
+/// - Parameter isSelected: 선택 여부
 func selected(_ isSelected: Bool) -> some View {
     self.modifier(ChipButtonIsSelectedModifier(isSelected: isSelected))
 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea42d48 and 0e31788.

📒 Files selected for processing (4)
  • AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButton.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonEnvironment.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonModifiers.swift
  • AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonSize.swift
🧰 Additional context used
🧬 Code graph analysis (1)
AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButton.swift (1)
AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonModifiers.swift (4)
  • body (20-22)
  • body (28-30)
  • selected (43-45)
  • buttonSize (39-41)
🔇 Additional comments (4)
AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonSize.swift (2)

18-27: Verify the height values are intentional.

The height progression (25 → 29 → 32) uses non-standard increments. Please confirm these specific values match the design specifications.


13-16: The current internal access control (default) is appropriate for this enum. ChipButtonSize is used exclusively within the UIComponents/ChipButton module and has no external dependencies, so adding public is unnecessary.

AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButton.swift (1)

55-59: ChipButtonSize automatically conforms to Equatable. The enum has no associated values, so Swift automatically synthesizes the conformance. The implementation in ChipButtonContent is correct.

AppProduct/AppProduct/Core/Common/UIComponents/ChipButton/ChipButtonModifiers.swift (1)

13-13: No action needed. The AnyChipButton protocol's internal access control is correct and consistent with the module design. The entire ChipButton component (including ChipButton struct itself) is internal, and AnyChipButton is only an internal implementation detail used for protocol conformance. Making it public while keeping ChipButton internal would be inconsistent and provide no external value.

Likely an incorrect or invalid review comment.

@UMC-PRODUCT UMC-PRODUCT deleted a comment from coderabbitai bot Jan 4, 2026
@UMC-PRODUCT UMC-PRODUCT deleted a comment from coderabbitai bot Jan 4, 2026
@UMC-PRODUCT UMC-PRODUCT deleted a comment from coderabbitai bot Jan 4, 2026
@UMC-PRODUCT UMC-PRODUCT deleted a comment from coderabbitai bot Jan 4, 2026
@UMC-PRODUCT UMC-PRODUCT deleted a comment from coderabbitai bot Jan 4, 2026
Copy link
Contributor

@jwon0523 jwon0523 left a comment

Choose a reason for hiding this comment

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

코드에 달아둔 리뷰 확인 후 수정해주세요!

private struct ChipButtonContent: View, Equatable {
let title: String
let size: ChipButtonSize
var isSelected: Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

isSelected는 값을 전달만 받기 때문에 let으로 선언하는게 더 나을거 같습니다.

Comment on lines 16 to 18
struct ChipButtonIsSelectedKey: EnvironmentKey {
static let defaultValue: Bool = false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ChipButton에서 이미 isSelected를 전달받고 있어서 해당 Environment는 불필요해 보입니다! isSelected는 사용시 필수적으로 사용될 값이니 파라미터로 두는게 더 나을거 같아요

Comment on lines 28 to 31
var chipButtonIsSelected: Bool {
get { self[ChipButtonIsSelectedKey.self] }
set { self[ChipButtonIsSelectedKey.self] = newValue }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

위에 커멘트와 같은 이유로 제거하면 됩니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

추가로 ChipButtonModifier.swift 파일에서도 관련된 내용들을 제거해주세요!

}
}

// MARK: - MainButtonContent (Presenter)
Copy link
Contributor

Choose a reason for hiding this comment

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

역할에 알맞게 주석 수정해주세요!

Copy link
Contributor

Choose a reason for hiding this comment

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

버튼 이름이 잘못되어 있어요!

@jwon0523 jwon0523 added the feat 새로운 기능을 추가합니다. label Jan 4, 2026
@jwon0523 jwon0523 self-requested a review January 4, 2026 09:25
Copy link
Contributor

@jwon0523 jwon0523 left a comment

Choose a reason for hiding this comment

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

고생했어요!!

@jwon0523 jwon0523 self-requested a review January 7, 2026 06:19
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.

3 participants