From 859d15585a7e13154ea366191da56b743fbee525 Mon Sep 17 00:00:00 2001 From: opficdev Date: Mon, 23 Nov 2026 12:36:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20DropdownMenu=20=ED=95=AD=EB=AA=A9?= =?UTF-8?q?=EC=97=90=20=EA=B3=A0=EB=A5=BC=20=EC=88=98=20=EC=97=86=EB=8A=94?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=20=ED=91=9C=EC=8B=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/Component/DropdownMenu.swift | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Application/Presentation/PresentationShared/Sources/Common/Component/DropdownMenu.swift b/Application/Presentation/PresentationShared/Sources/Common/Component/DropdownMenu.swift index 0e0f279b..bafef5bf 100644 --- a/Application/Presentation/PresentationShared/Sources/Common/Component/DropdownMenu.swift +++ b/Application/Presentation/PresentationShared/Sources/Common/Component/DropdownMenu.swift @@ -27,6 +27,7 @@ public struct DropdownMenuItem { let systemImage: String? let imageColor: Color? let isChecked: Bool + let isDisabled: Bool let role: ButtonRole? let kind: Kind @@ -35,6 +36,7 @@ public struct DropdownMenuItem { systemImage: String? = nil, imageColor: Color? = nil, isChecked: Bool = false, + isDisabled: Bool = false, role: ButtonRole? = nil, action: @escaping () -> Void ) { @@ -42,6 +44,7 @@ public struct DropdownMenuItem { self.systemImage = systemImage self.imageColor = imageColor self.isChecked = isChecked + self.isDisabled = isDisabled self.role = role self.kind = .action(action) } @@ -56,6 +59,7 @@ public struct DropdownMenuItem { self.systemImage = systemImage self.imageColor = imageColor self.isChecked = false + self.isDisabled = false self.role = nil self.kind = .submenu(submenu) } @@ -261,6 +265,7 @@ private struct DropdownMenuRow: View { let systemImage: String? let imageColor: Color? let isChecked: Bool + let isDisabled: Bool let isDestructive: Bool let hasSubmenu: Bool let action: () -> Void @@ -275,6 +280,7 @@ private struct DropdownMenuRow: View { self.systemImage = systemImage self.imageColor = imageColor self.isChecked = false + self.isDisabled = false self.isDestructive = false self.hasSubmenu = false self.action = action @@ -285,6 +291,7 @@ private struct DropdownMenuRow: View { self.systemImage = item.systemImage self.imageColor = item.imageColor self.isChecked = item.isChecked + self.isDisabled = item.isDisabled self.isDestructive = item.role == .destructive if case .submenu = item.kind { self.hasSubmenu = true @@ -304,7 +311,7 @@ private struct DropdownMenuRow: View { if let systemImage { Image(systemName: systemImage) .font(.system(size: iconSize * 0.8)) - .foregroundStyle(isDestructive ? Color.danger : imageColor ?? .secondaryLabel) + .foregroundStyle(isDisabled ? Color.tertiaryLabel : isDestructive ? .danger : imageColor ?? .secondaryLabel) .frame(width: iconSize, height: iconSize) } @@ -316,7 +323,7 @@ private struct DropdownMenuRow: View { if isChecked { Image(systemName: "checkmark") .font(.system(size: iconSize * 0.8, weight: .semibold)) - .foregroundStyle(Color.label) + .foregroundStyle(isDisabled ? Color.tertiaryLabel : .label) } else if hasSubmenu { Image(systemName: "chevron.right") .font(.system(size: iconSize * 0.7, weight: .semibold)) @@ -324,12 +331,14 @@ private struct DropdownMenuRow: View { } } .font(.system(size: isiOSAppOnMac ? 13 * AdaptiveSize.boardScale : 15)) - .foregroundStyle(isDestructive ? Color.danger : .primary) + // 고를 수 없는 항목은 흐린 글자 + .foregroundStyle(isDisabled ? Color.tertiaryLabel : isDestructive ? .danger : .primary) .frame(maxWidth: .infinity, minHeight: isiOSAppOnMac ? 28 * AdaptiveSize.boardScale : 44) .padding(.horizontal, isiOSAppOnMac ? 10 * AdaptiveSize.boardScale : 14) .contentShape(.rect) } .buttonStyle(DropdownMenuRowStyle(radius: CornerRadius.control)) + .disabled(isDisabled) } } @@ -341,6 +350,7 @@ private struct DropdownMenuRowStyle: ButtonStyle { } private struct Highlight: View { + @Environment(\.isEnabled) private var isEnabled @State private var isHovered = false let configuration: Configuration let radius: CGFloat @@ -348,7 +358,7 @@ private struct DropdownMenuRowStyle: ButtonStyle { var body: some View { configuration.label .background( - configuration.isPressed || isHovered ? Color.fill : .clear, + isEnabled && (configuration.isPressed || isHovered) ? Color.fill : .clear, in: .rect(cornerRadius: radius) ) .onHover { isHovered = $0 } From c0ff779967edf5b207e2ff1606ee82499294657c Mon Sep 17 00:00:00 2001 From: opficdev Date: Mon, 23 Nov 2026 12:36:09 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20=ED=99=9C=EB=8F=99=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EC=99=80=20=EC=97=B0=EB=8F=84=20=EC=84=A0=ED=83=9D=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=EB=A5=BC=20DropdownMenu=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Profile/ActivityCard.swift | 90 ++++++++++++------- 1 file changed, 60 insertions(+), 30 deletions(-) diff --git a/Application/Presentation/ProfileTab/Sources/Profile/ActivityCard.swift b/Application/Presentation/ProfileTab/Sources/Profile/ActivityCard.swift index 066ba48d..7639039f 100644 --- a/Application/Presentation/ProfileTab/Sources/Profile/ActivityCard.swift +++ b/Application/Presentation/ProfileTab/Sources/Profile/ActivityCard.swift @@ -31,23 +31,42 @@ struct ActivityCard: View { } .buttonStyle(.plain) } - Menu { - ForEach(ActivityKindItem.selectableItems) { activityKindItem in - if let activityKind = ActivityKind(rawValue: activityKindItem.rawValue) { - switch activityKind { + // 제목 줄 오른쪽 끝 버튼이라 메뉴 오른쪽 끝을 버튼 오른쪽 끝에 맞춤 + DropdownMenu( + alignment: .trailing, + sections: [ + DropdownMenuSection(items: ActivityKindItem.selectableItems.compactMap { activityKindItem in + switch ActivityKind(rawValue: activityKindItem.rawValue) { case .created: - Toggle(activityKindItem.title, isOn: $store.isCreatedActivitySelected) - .disabled(store.isCreatedActivityToggleDisabled) + DropdownMenuItem( + activityKindItem.title, + isChecked: store.isCreatedActivitySelected, + isDisabled: store.isCreatedActivityToggleDisabled + ) { + store.send(.binding(.set(\.isCreatedActivitySelected, !store.isCreatedActivitySelected))) + } case .completed: - Toggle(activityKindItem.title, isOn: $store.isCompletedActivitySelected) - .disabled(store.isCompletedActivityToggleDisabled) + DropdownMenuItem( + activityKindItem.title, + isChecked: store.isCompletedActivitySelected, + isDisabled: store.isCompletedActivityToggleDisabled + ) { + store.send(.binding(.set(\.isCompletedActivitySelected, !store.isCompletedActivitySelected))) + } case .deleted: - Toggle(activityKindItem.title, isOn: $store.isDeletedActivitySelected) - .disabled(store.isDeletedActivityToggleDisabled) + DropdownMenuItem( + activityKindItem.title, + isChecked: store.isDeletedActivitySelected, + isDisabled: store.isDeletedActivityToggleDisabled + ) { + store.send(.binding(.set(\.isDeletedActivitySelected, !store.isDeletedActivitySelected))) + } + case nil: + nil } - } - } - } label: { + }) + ] + ) { Image(systemName: "line.3.horizontal.decrease") .foregroundStyle(Color.label) } @@ -243,14 +262,17 @@ struct QuarterPickerSheet: View { .frame(height: 1) } - Menu { - Picker("", selection: $store.selectedQuarterPickerYear) { - ForEach(store.availableQuarterYears, id: \.self) { year in - Text(verbatim: String(year)) - .tag(year) - } - } - } label: { + // 연도 값이 행 오른쪽 끝에 있어 메뉴 오른쪽 끝을 행 오른쪽 끝에 맞춤 + DropdownMenu( + alignment: .trailing, + sections: [ + DropdownMenuSection(items: store.availableQuarterYears.map { year in + DropdownMenuItem(String(year), isChecked: store.selectedQuarterPickerYear == year) { + store.send(.binding(.set(\.selectedQuarterPickerYear, year))) + } + }) + ] + ) { HStack(spacing: 10 * AdaptiveSize.boardScale) { Text(String(localized: "profile_year", bundle: PresentationResources.bundle)) .foregroundStyle(Color.label) @@ -265,7 +287,6 @@ struct QuarterPickerSheet: View { .frame(minHeight: isiOSAppOnMac ? 38 * AdaptiveSize.boardScale : 50) .contentShape(.rect) } - .buttonStyle(.plain) .padding(.horizontal, isiOSAppOnMac ? 14 * AdaptiveSize.boardScale : 16) .padding(.vertical, isiOSAppOnMac ? 8 * AdaptiveSize.boardScale : 12) @@ -319,17 +340,26 @@ struct QuarterPickerSheet: View { .font(.adaptive(.subheadline)) .foregroundStyle(Color.secondaryLabel) Spacer() - Picker( - "", - selection: $store.selectedQuarterPickerYear + DropdownMenu( + alignment: .trailing, + sections: [ + DropdownMenuSection(items: store.availableQuarterYears.map { year in + DropdownMenuItem(String(year), isChecked: store.selectedQuarterPickerYear == year) { + store.send(.binding(.set(\.selectedQuarterPickerYear, year))) + } + }) + ] ) { - ForEach(store.availableQuarterYears, id: \.self) { year in - Text(verbatim: String(year)) - .tag(year) + HStack(spacing: 4) { + Text(verbatim: String(store.selectedQuarterPickerYear)) + .foregroundStyle(Color.label) + Image(systemName: "chevron.up.chevron.down") + .font(.adaptive(.caption2)) + .foregroundStyle(Color.secondaryLabel) } + .font(.adaptive(.subheadline)) + .contentShape(.rect) } - .pickerStyle(.menu) - .labelsHidden() } // 시트가 닫히며 사라지는 동안에도 버튼 줄을 그리도록 지연 그리기 없는 한 줄 배치