Skip to content

Commit

Permalink
Merge pull request #1164 from Infomaniak/update-non-native-menu-icons
Browse files Browse the repository at this point in the history
feat: Update menu icons and buttons
  • Loading branch information
PhilippeWeidmann authored Dec 6, 2023
2 parents 37a3c09 + 4e090c2 commit 3cfc1cb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
27 changes: 16 additions & 11 deletions Mail/Views/Menu Drawer/Folders/FolderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,33 @@ struct FolderCellContent: View {
private let isCurrentFolder: Bool
private let canCollapseSubFolders: Bool

init(folder: Folder, level: Int, isCurrentFolder: Bool, canCollapseSubFolders: Bool = false) {
self.folder = folder
self.level = min(level, UIConstants.menuDrawerMaximumSubFolderLevel)
self.isCurrentFolder = isCurrentFolder
self.canCollapseSubFolders = canCollapseSubFolders
}

private var textStyle: MailTextStyle {
if cellType == .menuDrawer {
return isCurrentFolder ? .bodyMediumAccent : .bodyMedium
}
return .body
}

private var canHaveChevron: Bool {
canCollapseSubFolders && cellType == .menuDrawer
}

init(folder: Folder, level: Int, isCurrentFolder: Bool, canCollapseSubFolders: Bool = false) {
self.folder = folder
self.level = min(level, UIConstants.menuDrawerMaximumSubFolderLevel)
self.isCurrentFolder = isCurrentFolder
self.canCollapseSubFolders = canCollapseSubFolders
}

var body: some View {
HStack(spacing: UIPadding.menuDrawerCellChevronSpacing) {
if canCollapseSubFolders && cellType == .menuDrawer {
HStack(spacing: 0) {
if canHaveChevron {
Button(action: collapseFolder) {
ChevronIcon(direction: folder.isExpanded ? .up : .down)
.padding(value: .regular)
}
.opacity(level == 0 && !folder.children.isEmpty ? 1 : 0)
.accessibilityLabel(MailResourcesStrings.Localizable.contentDescriptionButtonExpandFolder(folder.name))
.opacity(level == 0 && !folder.children.isEmpty ? 1 : 0)
}

HStack(spacing: UIPadding.menuDrawerCellSpacing) {
Expand All @@ -176,7 +181,7 @@ struct FolderCellContent: View {
}
}
.padding(.leading, UIPadding.menuDrawerSubFolder * CGFloat(level))
.padding(UIPadding.menuDrawerCell)
.padding(canHaveChevron ? UIPadding.menuDrawerCellWithChevron : UIPadding.menuDrawerCell)
.background(background)
}

Expand Down
3 changes: 2 additions & 1 deletion Mail/Views/Menu Drawer/Folders/UserFoldersListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct UserFoldersListView: View {
.textStyle(.bodySmallSecondary)
Spacer()
}
.padding(value: .regular)
}
.frame(maxWidth: .infinity)
.accessibilityLabel(MailResourcesStrings.Localizable.contentDescriptionButtonExpandCustomFolders)
Expand All @@ -57,13 +58,13 @@ struct UserFoldersListView: View {
isShowingCreateFolderAlert.toggle()
} label: {
IKIcon(MailResourcesAsset.addCircle)
.padding(value: .regular)
}
.accessibilityLabel(MailResourcesStrings.Localizable.newFolderDialogTitle)
.customAlert(isPresented: $isShowingCreateFolderAlert) {
CreateFolderView(mode: .create)
}
}
.padding(value: .regular)

if isExpanded {
if folders.isEmpty {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct MailboxesManagementView: View {
} label: {
HStack(spacing: UIPadding.menuDrawerCellSpacing) {
IKIcon(MailResourcesAsset.envelope, size: .large)
.foregroundStyle(.tint)

Text(mailboxManager.mailbox.email)
.textStyle(navigationDrawerState.showMailboxes ? .bodyMediumAccent : .bodyMedium)
Expand Down
1 change: 1 addition & 0 deletions MailCore/UI/UIPadding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public extension UIPadding {
// MARK: Menu

static let menuDrawerCell = EdgeInsets(top: intermediate, leading: regular, bottom: intermediate, trailing: regular)
static let menuDrawerCellWithChevron = EdgeInsets(top: 2, leading: 0, bottom: 2, trailing: regular)
static let menuDrawerCellSpacing = regular
static let menuDrawerCellChevronSpacing = intermediate
static let menuDrawerSubFolder = medium
Expand Down

0 comments on commit 3cfc1cb

Please sign in to comment.