Skip to content

Commit

Permalink
Merge pull request #774 from Infomaniak/fix-selection-background
Browse files Browse the repository at this point in the history
fix: Selection and multiple selection should have the same vertical padding
  • Loading branch information
adrien-coye committed Jun 6, 2023
2 parents 48bcaa0 + e0eacaf commit 3a34888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Mail/Components/SelectionBackground.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -59,15 +50,15 @@ 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 {
Rectangle()
.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, UIConstants.selectionBackgroundVerticalPadding)
.opacity(selectionType.opacity)
.animation(withAnimation ? .default : nil, value: selectionType.opacity)
}
Expand Down
3 changes: 3 additions & 0 deletions MailCore/UI/UIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3a34888

Please sign in to comment.