Skip to content

Comments

Refactor/#42 버튼 컴포넌트들 수정#44

Merged
sum130 merged 2 commits intodevelopfrom
refact/#42-buttonchipcomponent
Jan 12, 2026
Merged

Refactor/#42 버튼 컴포넌트들 수정#44
sum130 merged 2 commits intodevelopfrom
refact/#42-buttonchipcomponent

Conversation

@sum130
Copy link
Contributor

@sum130 sum130 commented Jan 12, 2026

🔗 연결된 이슈

📄 작업 내용

  • 버튼들, 칩, 미션카드 고정값이 아니라 padding 값으로 너비 조정합니다
구현 내용 IPhone 13 mini
GIF

@sum130 sum130 requested a review from a team January 12, 2026 13:19
@sum130 sum130 self-assigned this Jan 12, 2026
@sum130 sum130 requested review from soseoyo12, wotjs020708 and y-eonee and removed request for a team January 12, 2026 13:19
@sum130 sum130 added 수민🐶 Refactor 코드 리팩토링 시 사용 labels Jan 12, 2026
@sum130 sum130 linked an issue Jan 12, 2026 that may be closed by this pull request
1 task
@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

세 개의 UI 컴포넌트에서 고정 너비 제약을 제거하고 수평 확장을 허용하도록 레이아웃을 변경했으며, 버튼 타입의 공개 width 속성을 삭제하고 눌림 상태에 대한 크기 처리 방식을 fixed height + scale로 전환했습니다. (50단어 이내)

Changes

Cohort / File(s) 변경 요약
버튼 컴포넌트
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
버튼 레이블을 HStack으로 감싸 중앙 정렬로 조정. 스타일에서 동적 width/height 프레임을 제거하고 고정 높이(frame(height: ...)) + scaleEffect로 눌림 상태 처리로 변경. CherrishButtonType의 public width: CGFloat 프로퍼티 삭제.
카드 및 칩 컴포넌트
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift, Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
기존 고정 너비(width: 148)를 제거하고 frame(maxWidth: .infinity)로 수평 확장하도록 변경. 높이(height: 80)와 배경/스트로크/상호작용 로직은 유지.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • wotjs020708
  • y-eonee
  • soseoyo12
🚥 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
Description check ✅ Passed PR 설명은 버튼, 칩, 미션카드의 고정값 너비를 padding 기반으로 조정한 작업 내용을 명확히 설명합니다.
Linked Issues check ✅ Passed PR은 #42의 주요 목표인 버튼과 칩 컴포넌트를 padding 기반 너비 조절로 리팩터링하는 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항은 #42의 컴포넌트 너비 조정 목표와 관련성이 있으며 범위를 벗어나지 않습니다.
Title check ✅ Passed PR 제목은 버튼 컴포넌트 수정에 관한 것으로, 실제 변경사항(버튼, 칩, 미션카드 컴포넌트의 너비 조정)과 부분적으로만 관련이 있습니다.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refact/#42-buttonchipcomponent

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)

10-28: 고려사항: MissionCard와의 스타일 중복

SelectionChipMissionCard가 동일한 시각적 스타일(높이 80, cornerRadius 10, 동일한 색상 체계)을 공유합니다. 현재는 문제가 되지 않지만, 향후 유지보수성을 위해 공통 스타일을 ViewModifier나 공유 스타일 컴포넌트로 추출하는 것을 고려해볼 수 있습니다.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62d67f9 and e5f3c08.

📒 Files selected for processing (3)
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
🧰 Additional context used
🧬 Code graph analysis (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (4)
  • red200 (69-71)
  • gray0 (9-11)
  • red500 (81-83)
  • gray500 (29-31)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift (1)

33-33: LGTM!

고정 너비(148)를 maxWidth: .infinity로 변경하여 컴포넌트가 사용 가능한 수평 공간을 채울 수 있도록 적절히 수정되었습니다. 높이는 80으로 유지되어 카드의 일관된 세로 크기를 보장합니다.

Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)

19-27: LGTM!

고정 너비를 maxWidth: .infinity로 변경하여 MissionCard와 일관된 유연한 레이아웃 방식을 적용했습니다. 높이(80), cornerRadius(10), 색상 로직이 적절히 유지되었습니다.

Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (1)

46-55: LGTM!

타입별 고정 너비를 제거하고 maxWidth: .infinity로 변경하여 버튼이 가용 공간을 채우도록 적절히 리팩터링되었습니다. 타입별 높이(.save: 44, 기본값: 50)와 cornerRadius(.save: 10, 기본값: 12)는 유지되어 각 버튼 유형의 시각적 특성을 보존하며, isPressed 상태의 애니메이션(0.95 배수)도 일관되게 적용됩니다.

이 버튼 컴포넌트가 실제 뷰에 통합될 때 상위 컨테이너에서 적절한 padding이나 frame 제약을 통해 버튼 너비가 올바르게 제어되는지 확인하세요.

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: 3

🤖 Fix all issues with AI agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift:
- Around line 111-172: In CherrishButtonPreviewWrapper replace the explicit
CGFloat initializer used in the padding modifier (currently written as
CGFloat(8) on the CherrishButton instance) with a plain numeric literal (8) so
Swift infers the type; update the padding call on the second CherrishButton (the
one with comment "// NEXT - 활성") to use .padding(8) instead of
.padding(CGFloat(8)).
- Around line 50-58: In makeBody(configuration:), remove the redundant
cornerRadius scaling so the pressed visual is driven by scaleEffect only: keep
scaleEffect(configuration.isPressed ? 0.95 : 1.0) and change the
clipShape(RoundedRectangle(...)) to always use type.cornerRadius (do not
multiply by 0.95 when configuration.isPressed); this removes the double-shrink
effect when Configuration.isPressed while preserving the existing press
animation.

In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift:
- Around line 19-25: The background color is applied as a rectangle so its
corners stay square while the overlay stroke is rounded; update the background
to use a rounded shape filled with the conditional color (e.g., replace
.background(isSelected ? .red200 : .gray0) with a RoundedRectangle(cornerRadius:
10).fill(isSelected ? .red200 : .gray0)) so the fill matches the overlay stroke;
ensure you keep the existing overlay RoundedRectangle(cornerRadius:
10).stroke(...) and the frame modifiers intact to preserve sizing and selection
logic in SelectionChip.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5f3c08 and e48c019.

📒 Files selected for processing (3)
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift
  • Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
🧰 Additional context used
🧬 Code graph analysis (2)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (4)
  • red200 (69-71)
  • gray0 (9-11)
  • red500 (81-83)
  • gray500 (29-31)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Font+.swift (1)
  • typography (60-65)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Shadow.swift (1)
  • body (9-17)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (1)
  • gray100 (13-15)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift (1)

33-34: LGTM!

고정 너비를 제거하고 maxWidth: .infinity를 사용하여 유연한 너비를 적용한 변경이 PR 목표에 부합합니다. 높이는 80으로 유지되어 일관된 레이아웃을 보장합니다.

Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)

26-28: LGTM!

탭 제스처 처리가 올바르게 구현되어 있습니다.

Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (1)

31-37: LGTM!

HStackSpacer를 사용하여 버튼 텍스트를 중앙 정렬하는 방식이 유연한 너비와 함께 잘 작동합니다.

Comment on lines 50 to 58
func makeBody(configuration: Configuration) -> some View {
configuration.label
.frame(
width: configuration.isPressed ? type.width * 0.95 : type.width,
height: configuration.isPressed ? type.height * 0.95 : type.height
)
.frame(height: type.height)
.background(type.backgroundColor(for: state))
.clipShape(RoundedRectangle(cornerRadius: configuration.isPressed
? type.cornerRadius * 0.95
: type.cornerRadius))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

scaleEffectcornerRadius 조정의 중복 가능성을 검토하세요.

scaleEffect(0.95)는 전체 뷰를 축소하므로 cornerRadius도 시각적으로 비례하여 줄어듭니다. 여기에 cornerRadius * 0.95를 추가로 적용하면 모서리가 의도한 것보다 더 날카롭게 보일 수 있습니다.

♻️ cornerRadius 조정 제거 제안
     func makeBody(configuration: Configuration) -> some View {
         configuration.label
             .frame(height: type.height)
             .background(type.backgroundColor(for: state))
-            .clipShape(RoundedRectangle(cornerRadius: configuration.isPressed
-                                        ? type.cornerRadius * 0.95
-                                        : type.cornerRadius))
+            .clipShape(RoundedRectangle(cornerRadius: type.cornerRadius))
             .scaleEffect(configuration.isPressed ? 0.95 : 1.0)
     }
🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
around lines 50 - 58, In makeBody(configuration:), remove the redundant
cornerRadius scaling so the pressed visual is driven by scaleEffect only: keep
scaleEffect(configuration.isPressed ? 0.95 : 1.0) and change the
clipShape(RoundedRectangle(...)) to always use type.cornerRadius (do not
multiply by 0.95 when configuration.isPressed); this removes the double-shrink
effect when Configuration.isPressed while preserving the existing press
animation.

Comment on lines +111 to +172
struct CherrishButtonPreviewWrapper: View {

@State private var nextState: ButtonState = .normal
@State private var activeNextState: ButtonState = .active
@State private var dummyState: ButtonState = .active

var body: some View {
VStack(spacing: 16) {

// NEXT - 비활성
CherrishButton(
title: "다음",
type: .next,
state: $nextState
) {
print("Next (normal)")
}

// NEXT - 활성
CherrishButton(
title: "다음",
type: .next,
state: $activeNextState
) {
print("Next (active)")
}
.padding(CGFloat(8))

// CONFIRM
CherrishButton(
title: "확인",
type: .confirm,
state: $dummyState
) {
print("Confirm")
}

// SAVE
CherrishButton(
title: "등록하기",
type: .save,
state: $dummyState
) {
print("Save")
}

// ADD EVENT
CherrishButton(
title: "다운타임 없이 일정 추가",
type: .addEvent,
state: $dummyState
) {
print("Add Event")
}
}
.padding()
.background(Color.gray100)
}
}
#Preview {
CherrishButtonPreviewWrapper()
}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

프리뷰 래퍼 추가가 좋습니다.

모든 버튼 타입과 상태를 테스트할 수 있는 프리뷰 래퍼가 개발에 유용합니다. 다만 Line 137의 CGFloat(8)은 단순히 8로 작성해도 Swift가 자동으로 타입을 추론합니다.

🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
around lines 111 - 172, In CherrishButtonPreviewWrapper replace the explicit
CGFloat initializer used in the padding modifier (currently written as
CGFloat(8) on the CherrishButton instance) with a plain numeric literal (8) so
Swift infers the type; update the padding call on the second CherrishButton (the
one with comment "// NEXT - 활성") to use .padding(8) instead of
.padding(CGFloat(8)).

Comment on lines +19 to +25
.frame(maxWidth: .infinity)
.frame(height: 80)
.background(isSelected ? .red200 : .gray0)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(isSelected ? .red500 : .gray500, lineWidth: 1)
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

배경 색상에 라운드 처리가 누락되었습니다.

.background() 수정자는 색상을 직사각형으로 채우므로 배경의 모서리가 둥글게 표시되지 않습니다. overlayRoundedRectangle stroke는 테두리만 둥글게 처리하고 배경은 그대로 둡니다.

🔧 배경에 라운드 처리를 적용하는 수정안
             .frame(maxWidth: .infinity)
             .frame(height: 80)
-            .background(isSelected ? .red200 : .gray0)
+            .background(
+                RoundedRectangle(cornerRadius: 10)
+                    .fill(isSelected ? .red200 : .gray0)
+            )
             .overlay(
                 RoundedRectangle(cornerRadius: 10)
                     .stroke(isSelected ? .red500 : .gray500, lineWidth: 1)
             )
🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
around lines 19 - 25, The background color is applied as a rectangle so its
corners stay square while the overlay stroke is rounded; update the background
to use a rounded shape filled with the conditional color (e.g., replace
.background(isSelected ? .red200 : .gray0) with a RoundedRectangle(cornerRadius:
10).fill(isSelected ? .red200 : .gray0)) so the fill matches the overlay stroke;
ensure you keep the existing overlay RoundedRectangle(cornerRadius:
10).stroke(...) and the frame modifiers intact to preserve sizing and selection
logic in SelectionChip.

@y-eonee y-eonee changed the title refactor: #42 버튼 컴포넌트들 수정 Refactor/#42 버튼 컴포넌트들 수정 Jan 12, 2026
Copy link
Contributor

@y-eonee y-eonee left a comment

Choose a reason for hiding this comment

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

굿~!

}


struct CherrishButtonPreviewWrapper: View {
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.

해줘!

Copy link
Contributor

@wotjs020708 wotjs020708 left a comment

Choose a reason for hiding this comment

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

어푸푸 고생하셨습니다.
KakaoTalk_Photo_2026-01-09-22-59-49 012

.clipShape(RoundedRectangle(cornerRadius: configuration.isPressed
? type.cornerRadius * 0.95
: type.cornerRadius))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
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.

}


struct CherrishButtonPreviewWrapper: View {
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

@soseoyo12 soseoyo12 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!~~~

.clipShape(RoundedRectangle(cornerRadius: configuration.isPressed
? type.cornerRadius * 0.95
: type.cornerRadius))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

@sum130 sum130 merged commit ee800b4 into develop Jan 12, 2026
1 check passed
@sum130 sum130 deleted the refact/#42-buttonchipcomponent branch January 12, 2026 16:11
Kimgyuilli pushed a commit that referenced this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor 코드 리팩토링 시 사용 수민🐶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] 버튼 및 칩 컴포넌트 수정

4 participants