From e5f3c089111828ef3acf8992c452a3d310d39eae Mon Sep 17 00:00:00 2001 From: sum130 Date: Mon, 12 Jan 2026 22:15:15 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20#42=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=93=A4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Components/CherrishButton.swift | 11 +---------- .../Global/Components/MissionCard.swift | 2 +- .../Global/Components/SelectionChip.swift | 18 +++++++++--------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift index 8907278f..f964a5f0 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift @@ -45,7 +45,7 @@ struct CherrishButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .frame( - width: configuration.isPressed ? type.width * 0.95 : type.width, + maxWidth: .infinity, height: configuration.isPressed ? type.height * 0.95 : type.height ) .background(type.backgroundColor(for: state)) @@ -58,15 +58,6 @@ struct CherrishButtonStyle: ButtonStyle { extension CherrishButtonType { - var width: CGFloat { - switch self { - case .next: return 326 - case .confirm: return 126 - case .save: return 278 - case .addEvent: return 196 - } - } - var height: CGFloat { switch self { case .save: return 44 diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift index 601b0568..570e3925 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift @@ -30,7 +30,7 @@ struct MissionCard: View { } .padding(.horizontal, 7) .padding(.vertical, 6) - .frame(width: 148, height: 80) + .frame(maxWidth: .infinity, height: 80) .background(isSelected ? .red200 : .gray0) .overlay( RoundedRectangle(cornerRadius: 10) diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift index dc042241..28f30b75 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift @@ -16,14 +16,14 @@ struct SelectionChip: View { Text(title) .typography(.body1_m_14) .foregroundStyle(isSelected ? .gray800 : .gray700) - .frame(width: 148, height: 80) - .background(isSelected ? .red200 : .gray0) - .overlay( - RoundedRectangle(cornerRadius: 10) - .stroke(isSelected ? .red500 : .gray500, lineWidth: 1) - ) - .onTapGesture { - isSelected.toggle() - } + .frame(maxWidth: .infinity, height: 80) + .background(isSelected ? .red200 : .gray0) + .overlay( + RoundedRectangle(cornerRadius: 10) + .stroke(isSelected ? .red500 : .gray500, lineWidth: 1) + ) + .onTapGesture { + isSelected.toggle() + } } } From e48c0194cea07a173e998a015c727cf28f12bcca Mon Sep 17 00:00:00 2001 From: sum130 Date: Mon, 12 Jan 2026 23:54:49 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20#42=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=8A=A4=EC=BC=80?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Components/CherrishButton.swift | 84 +++++++++++++++++-- .../Global/Components/MissionCard.swift | 3 +- .../Global/Components/SelectionChip.swift | 3 +- 3 files changed, 80 insertions(+), 10 deletions(-) diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift index f964a5f0..71166753 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift @@ -28,9 +28,14 @@ struct CherrishButton: View { var body: some View { Button(action: action) { - Text(title) - .typography(.title2_sb_16) - .foregroundStyle(type.textColor(for: state)) + HStack{ + Spacer() + Text(title) + .typography(.title2_sb_16) + .foregroundStyle(type.textColor(for: state)) + Spacer() + } + } .buttonStyle(CherrishButtonStyle(state: state, type: type)) .disabled(type.isDisabled(for: state)) @@ -44,18 +49,15 @@ struct CherrishButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label - .frame( - maxWidth: .infinity, - 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) } } - extension CherrishButtonType { var height: CGFloat { @@ -104,3 +106,69 @@ extension CherrishButtonType { } } } + + +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() +} + + diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift index 570e3925..37175341 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift @@ -30,7 +30,8 @@ struct MissionCard: View { } .padding(.horizontal, 7) .padding(.vertical, 6) - .frame(maxWidth: .infinity, height: 80) + .frame(maxWidth: .infinity) + .frame(height: 80) .background(isSelected ? .red200 : .gray0) .overlay( RoundedRectangle(cornerRadius: 10) diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift index 28f30b75..f26d72ce 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift @@ -16,7 +16,8 @@ struct SelectionChip: View { Text(title) .typography(.body1_m_14) .foregroundStyle(isSelected ? .gray800 : .gray700) - .frame(maxWidth: .infinity, height: 80) + .frame(maxWidth: .infinity) + .frame(height: 80) .background(isSelected ? .red200 : .gray0) .overlay( RoundedRectangle(cornerRadius: 10)