Skip to content

Commit

Permalink
Merge pull request #470 from Infomaniak/fonts
Browse files Browse the repository at this point in the history
Fonts
  • Loading branch information
PhilippeWeidmann authored Jan 6, 2023
2 parents 6a2a45c + 48a910d commit 0a21a64
Show file tree
Hide file tree
Showing 53 changed files with 132 additions and 176 deletions.
2 changes: 1 addition & 1 deletion Mail/Components/BottomSheetButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct BottomSheetButton: View {
var body: some View {
Button(action: action) {
Text(label)
.textStyle(.header5OnAccent)
.textStyle(.bodyMediumOnAccent)
.padding(.horizontal, 12) // Button has already a 12pt horizontal padding
.padding(.vertical, 11) // Button has already a 7pt vertical padding
}
Expand Down
2 changes: 1 addition & 1 deletion Mail/Components/FloatingActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct FloatingActionButton: View {
Button(action: action) {
Label {
Text(title)
.textStyle(.header5OnAccent)
.textStyle(.bodyMediumOnAccent)
} icon: {
icon
.resizable()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Components/LargeButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct LargeButton<Label>: View where Label: View {
ProgressView()
} else {
label
.textStyle(.header5OnAccent)
.textStyle(.bodyMediumOnAccent)
}
}
.padding(.vertical, 10)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Components/LargePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct LargePicker<SelectionValue, ButtonType>: View where SelectionValue: Hasha
VStack(alignment: .leading, spacing: 4) {
if let title = title {
Text(title)
.textStyle(.callout)
.textStyle(.bodySmall)
}

Menu {
Expand Down
26 changes: 11 additions & 15 deletions Mail/Components/ThreadCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension Animation {

extension ThreadDensity {
var cellVerticalPadding: CGFloat {
self == .compact ? 10 : 16
self == .compact ? 10 : 12
}
}

Expand All @@ -49,11 +49,7 @@ struct ThreadCell: View {
var isSelected = false

private var checkboxSize: CGFloat {
threadDensity == .compact ? Constants.checkboxCompactSize : Constants.checkboxSize
}

private var checkmarkSize: CGFloat {
threadDensity == .compact ? Constants.checkmarkCompactSize : Constants.checkmarkSize
threadDensity == .large ? Constants.checkboxLargeSize : Constants.checkboxSize
}

// MARK: - Views
Expand All @@ -67,7 +63,7 @@ struct ThreadCell: View {
Group {
if threadDensity == .large, let recipient = thread.from.last {
ZStack {
RecipientImage(recipient: recipient, size: 32)
RecipientImage(recipient: recipient)
checkbox
.opacity(isSelected ? 1 : 0)
}
Expand All @@ -79,7 +75,7 @@ struct ThreadCell: View {
}
.padding(.trailing, 4)

VStack(alignment: .leading, spacing: 8) {
VStack(alignment: .leading, spacing: 4) {
cellHeader

HStack(alignment: .top, spacing: 3) {
Expand Down Expand Up @@ -111,7 +107,7 @@ struct ThreadCell: View {
.frame(width: checkboxSize, height: checkboxSize)
Image(resource: MailResourcesAsset.check)
.foregroundColor(MailResourcesAsset.onAccentColor)
.frame(height: checkmarkSize)
.frame(height: Constants.checkmarkSize)
.opacity(isSelected ? 1 : 0)
}
}
Expand All @@ -125,12 +121,12 @@ struct ThreadCell: View {
.layoutPriority(1)
}
Text(thread.messages.allSatisfy(\.isDraft) ? thread.formattedTo : thread.formattedFrom)
.textStyle(.header5)
.textStyle(.header2)
.lineLimit(1)

if thread.messages.count > 1 {
Text("\(thread.messages.count)")
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
.padding(.horizontal, 4)
.lineLimit(1)
.overlay {
Expand All @@ -142,21 +138,21 @@ struct ThreadCell: View {
Spacer()

Text(thread.date.customRelativeFormatted)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
.lineLimit(1)
}
}

private var threadInfo: some View {
VStack(alignment: .leading, spacing: 8) {
VStack(alignment: .leading, spacing: 4) {
Text(thread.formattedSubject)
.textStyle(.callout)
.textStyle(.body)
.lineLimit(1)

if threadDensity != .compact,
let preview = thread.messages.last?.preview {
Text(preview.isEmpty ? MailResourcesStrings.Localizable.noBodyTitle : preview)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
.lineLimit(1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Mail/Components/ToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct ToolbarButton: View {
Button(action: action) {
Label {
Text(text)
.textStyle(MailTextStyle.captionMediumSecondary)
.textStyle(MailTextStyle.labelMediumAccent)
} icon: {
Image(resource: icon)
.resizable()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Attachment/AttachmentPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct AttachmentPreview: View {
Button(action: download) {
Label {
Text(MailResourcesStrings.Localizable.buttonDownload)
.font(MailTextStyle.captionSecondary.font)
.font(MailTextStyle.labelSecondary.font)
} icon: {
Image(resource: MailResourcesAsset.download)
.resizable()
Expand Down
4 changes: 2 additions & 2 deletions Mail/Views/Bottom sheets/Actions/ActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ActionsView: View {
// Header
Text(MailResourcesStrings.Localizable.actionsMenuTitle)
.frame(maxWidth: .infinity, alignment: .leading)
.textStyle(.header5)
.textStyle(.bodyMedium)
.padding(.horizontal, 24)
// Quick actions
HStack(alignment: .top, spacing: 28) {
Expand Down Expand Up @@ -106,7 +106,7 @@ struct QuickActionView: View {
.aspectRatio(1, contentMode: .fit)

Text(action.title)
.textStyle(.captionMediumAccent)
.textStyle(.labelMediumAccent)
.lineLimit(action.title.split(separator: " ").count > 1 ? nil : 1)
.minimumScaleFactor(0.75)
}
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/AddLinkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct AddLinkView: View {
var body: some View {
VStack(alignment: .leading, spacing: 24) {
Text(MailResourcesStrings.Localizable.urlEntryTitle)
.textStyle(.header5)
.textStyle(.bodyMedium)
TextField(MailResourcesStrings.Localizable.urlPlaceholder, text: $url)
.textFieldStyle(.roundedBorder)
.focused($isFocused)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/BottomSheetButtonsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct BottomSheetButtonsView: View {
HStack(spacing: 24) {
Button(role: .destructive, action: secondaryButtonAction) {
Text(secondaryButtonTitle)
.textStyle(.header5Error)
.textStyle(.bodyMediumError)
}

BottomSheetButton(label: primaryButtonTitle,
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/ContactActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ContactActionsView: View {
RecipientImage(recipient: recipient, size: 32)
VStack(alignment: .leading) {
Text(recipient.contact?.name ?? recipient.title)
.textStyle(.header5)
.textStyle(.bodyMedium)
Text(recipient.contact?.email ?? recipient.email)
.textStyle(.bodySecondary)
}
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/CreateFolderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct CreateFolderView: View {
// Header
Text(MailResourcesStrings.Localizable.createFolderTitle)
.frame(maxWidth: .infinity, alignment: .leading)
.textStyle(.header4)
.textStyle(.bodyMedium)
// Text field
TextField(MailResourcesStrings.Localizable.createFolderName, text: $folderName)
.padding(12)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/LogoutConfirmationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct LogoutConfirmationView: View {
var body: some View {
VStack(alignment: .leading, spacing: 24) {
Text( MailResourcesStrings.Localizable.confirmLogoutTitle(account.user.email))
.textStyle(.header5)
.textStyle(.bodyMedium)
Text(MailResourcesStrings.Localizable.confirmLogoutDescription)
.textStyle(.bodySecondary)
BottomSheetButtonsView(primaryButtonTitle: MailResourcesStrings.Localizable.buttonLogout,
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/MoreStorageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct MoreStorageView: View {
var body: some View {
VStack(alignment: .leading) {
Text(MailResourcesStrings.Localizable.moreStorageTitle)
.textStyle(.header4)
.textStyle(.bodyMedium)

Image(resource: MailResourcesAsset.moreStorage)
.resizable()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/MoveEmailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct MoveEmailView: View {
VStack(alignment: .trailing, spacing: 24) {
Text(MailResourcesStrings.Localizable.moveTitle)
.frame(maxWidth: .infinity, alignment: .leading)
.textStyle(.header4)
.textStyle(.bodyMedium)
Image(resource: MailResourcesAsset.moveIllu)
.resizable()
.scaledToFit()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/ReportDisplayProblemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct ReportDisplayProblemView: View {
var body: some View {
VStack(spacing: 16) {
Text(MailResourcesStrings.Localizable.reportDisplayProblemTitle)
.textStyle(.header4)
.textStyle(.bodyMedium)
.frame(maxWidth: .infinity, alignment: .leading)
Image(resource: MailResourcesAsset.displayIssue)
Text(MailResourcesStrings.Localizable.reportDisplayProblemDescription)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/ReportPhishingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ReportPhishingView: View {
var body: some View {
VStack(spacing: 16) {
Text(MailResourcesStrings.Localizable.reportPhishingTitle)
.textStyle(.header4)
.textStyle(.bodyMedium)
.frame(maxWidth: .infinity, alignment: .leading)
Image(resource: MailResourcesAsset.phishing)
Text(MailResourcesStrings.Localizable.reportPhishingDescription)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/RestoreEmailsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RestoreEmailsView: View {
var body: some View {
VStack(alignment: .leading) {
Text(MailResourcesStrings.Localizable.restoreEmailsTitle)
.textStyle(.header4)
.textStyle(.bodyMedium)
.padding(.bottom, 16)

Text(MailResourcesStrings.Localizable.restoreEmailsText)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Menu Drawer/Actions/HelpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct HelpView: View {
.listRowInsets(.init())
} header: {
Text(MailResourcesStrings.Localizable.helpSubtitle)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
}
.listSectionSeparator(.hidden)
}
Expand Down
4 changes: 2 additions & 2 deletions Mail/Views/Menu Drawer/Folders/FolderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct FolderCellContent: View {
}

private var textStyle: MailTextStyle {
isSelected ? .header5Accent : .header5
isSelected ? .bodyMediumAccent : .bodyMedium
}

var body: some View {
Expand All @@ -96,7 +96,7 @@ struct FolderCellContent: View {
Spacer()

Text(folder.formattedUnreadCount)
.textStyle(isSelected ? .calloutStrongAccent : .calloutMediumAccent)
.textStyle(.bodySmallMediumAccent)
}
.padding(.vertical, Constants.menuDrawerVerticalPadding)
.padding(.horizontal, Constants.menuDrawerHorizontalPadding)
Expand Down
4 changes: 2 additions & 2 deletions Mail/Views/Menu Drawer/Folders/UserFoldersListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct UserFoldersListView: View {
HStack(spacing: 12) {
ChevronIcon(style: isExpanded ? .up : .down, color: .secondary)
Text(MailResourcesStrings.Localizable.buttonFolders)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
Spacer()
Button {
globalAlert.state = .createNewFolder(mode: .create)
Expand All @@ -61,7 +61,7 @@ struct UserFoldersListView: View {

if folders.isEmpty {
Text(MailResourcesStrings.Localizable.noFolderTitle)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
.padding(.top, 16)
.padding(.bottom, 8)
} else {
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Menu Drawer/Items/MenuDrawerItemCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct MenuDrawerItemCell: View {
.foregroundColor(.accentColor)

Text(content.label)
.textStyle(.header5)
.textStyle(.bodyMedium)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Menu Drawer/Items/MenuDrawerItemsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct MenuDrawerItemsListView: View {
HStack(spacing: 12) {
ChevronIcon(style: isExpanded ? .up : .down, color: .secondary)
Text(title)
.textStyle(.calloutSecondary)
.textStyle(.bodySmallSecondary)
Spacer()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct MailboxesManagementButtonView: View {
Spacer()
if let detailNumber = detailNumber {
Text(detailNumber < 100 ? "\(detailNumber)" : "99+")
.textStyle(.calloutMediumAccent)
.textStyle(.bodySmallMediumAccent)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct MailboxesManagementView: View {
.foregroundColor(.accentColor)
.padding(.trailing, 16)
Text(mailboxManager.mailbox.email)
.textStyle(.header5Accent)
.textStyle(.bodyMediumAccent)
.lineLimit(1)
Spacer()
ChevronIcon(style: navigationDrawerState.showMailboxes ? .up : .down, color: .primary)
Expand Down
13 changes: 3 additions & 10 deletions Mail/Views/Menu Drawer/MailboxQuotaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,11 @@ struct MailboxQuotaView: View {
@EnvironmentObject var globalSheet: GlobalBottomSheet

let quotas: Quotas
var progressString: AttributedString {
let localizedText = MailResourcesStrings.Localizable.menuDrawerMailboxStorage(
var progressString: String {
return MailResourcesStrings.Localizable.menuDrawerMailboxStorage(
Int64(quotas.size * 1000).formatted(.defaultByteCount),
Constants.sizeLimit.formatted(.defaultByteCount)
)

var attributedString = AttributedString(localizedText)
if let lastWord = localizedText.split(separator: " ").last, let range = attributedString.range(of: lastWord) {
attributedString[range].font = MailTextStyle.header3.font
}

return attributedString
}

var body: some View {
Expand All @@ -47,7 +40,7 @@ struct MailboxQuotaView: View {

VStack(alignment: .leading, spacing: 6) {
Text(progressString)
.textStyle(.header5)
.textStyle(.bodyMedium)
}

Spacer()
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Menu Drawer/MenuDrawerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct AppVersionView: View {
var body: some View {
IKDivider(withPadding: true)
Text(Constants.appVersion())
.textStyle(.captionSecondary)
.textStyle(.labelSecondary)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/New Message/ComposeMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct ComposeMessageView: View {
NewMessageCell(type: .from,
isFirstCell: true) {
Text(mailboxManager.mailbox.email)
.textStyle(.header5Accent)
.textStyle(.bodyMediumAccent)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Mail/Views/NoMailboxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct NoMailboxView: View {
.frame(width: 110, height: 110)
.padding(.bottom, 56)
Text(MailResourcesStrings.Localizable.noMailboxTitle)
.textStyle(.header1)
.textStyle(.header2)
.padding(.horizontal, 48)
.padding(.bottom, 16)
Text(MailResourcesStrings.Localizable.noMailboxDescription)
Expand All @@ -48,7 +48,7 @@ struct NoMailboxView: View {
(window?.windowScene?.delegate as? SceneDelegate)?.showLoginView()
} label: {
Text(MailResourcesStrings.Localizable.buttonLogInDifferentAccount)
.textStyle(.header5Accent)
.textStyle(.bodyMediumAccent)
}
}
}
Expand Down
Loading

0 comments on commit 0a21a64

Please sign in to comment.