Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Selection and multiple selection should have the same vertical padding #774

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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