From 50e9ecfe0af178a0604f17e83f14d85897d445d0 Mon Sep 17 00:00:00 2001 From: Valentin Perignon Date: Tue, 6 Jun 2023 14:04:00 +0200 Subject: [PATCH 1/2] fix: Selection and multiple selection should have the same vertical padding --- Mail/Components/SelectionBackground.swift | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Mail/Components/SelectionBackground.swift b/Mail/Components/SelectionBackground.swift index f0ba725a0..f78d4981b 100644 --- a/Mail/Components/SelectionBackground.swift +++ b/Mail/Components/SelectionBackground.swift @@ -26,15 +26,6 @@ enum SelectionBackgroundKind { case folder case single - var verticalPadding: CGFloat { - switch self { - case .multiple: - return 2 - default: - return 0 - } - } - var opacity: Double { switch self { case .none: @@ -67,7 +58,7 @@ struct SelectionBackground: View { .fill(selectionType == .single ? MailResourcesAsset.elementsColor.swiftUIColor : accentColor.secondary.swiftUIColor) .clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .bottomLeft])) .padding(.leading, paddingLeading) - .padding(.vertical, selectionType.verticalPadding) + .padding(.vertical, 2) .opacity(selectionType.opacity) .animation(withAnimation ? .default : nil, value: selectionType.opacity) } From e0eacafd243314d592d8e12b461817e6afc999ff Mon Sep 17 00:00:00 2001 From: Valentin Perignon Date: Tue, 6 Jun 2023 14:39:01 +0200 Subject: [PATCH 2/2] refactor: Use constants --- Mail/Components/SelectionBackground.swift | 4 ++-- MailCore/UI/UIConstants.swift | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Mail/Components/SelectionBackground.swift b/Mail/Components/SelectionBackground.swift index f78d4981b..881d32cd5 100644 --- a/Mail/Components/SelectionBackground.swift +++ b/Mail/Components/SelectionBackground.swift @@ -50,7 +50,7 @@ struct SelectionBackground: View { @AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor let selectionType: SelectionBackgroundKind - var paddingLeading: CGFloat = 8 + var paddingLeading = UIConstants.selectionBackgroundDefaultLeadingPadding var withAnimation = true var body: some View { @@ -58,7 +58,7 @@ struct SelectionBackground: View { .fill(selectionType == .single ? MailResourcesAsset.elementsColor.swiftUIColor : accentColor.secondary.swiftUIColor) .clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .bottomLeft])) .padding(.leading, paddingLeading) - .padding(.vertical, 2) + .padding(.vertical, UIConstants.selectionBackgroundVerticalPadding) .opacity(selectionType.opacity) .animation(withAnimation ? .default : nil, value: selectionType.opacity) } diff --git a/MailCore/UI/UIConstants.swift b/MailCore/UI/UIConstants.swift index a6089f802..3a7b9540d 100644 --- a/MailCore/UI/UIConstants.swift +++ b/MailCore/UI/UIConstants.swift @@ -95,6 +95,9 @@ public enum UIConstants { public static let checkboxAppearDelay = 0.2 public static let checkboxDisappearOffsetDelay = 0.35 + public static let selectionBackgroundDefaultLeadingPadding: CGFloat = 8 + public static let selectionBackgroundVerticalPadding: CGFloat = 2 + public static let buttonsRadius: CGFloat = 16 public static let buttonsIconSize: CGFloat = 16