From 4f6176aaf978336b202405bd4533c8d480139a90 Mon Sep 17 00:00:00 2001 From: Valentin Perignon Date: Wed, 31 Jan 2024 14:48:15 +0100 Subject: [PATCH] fix: Recipient names fill the available space --- Mail/Components/ThreadCell/ThreadCell.swift | 2 +- ...ift => ThreadCellAvatarCheckboxView.swift} | 4 +-- .../ThreadCell/ThreadCellHeaderView.swift | 29 ++++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) rename Mail/Components/ThreadCell/{ThreadCellCheckboxView.swift => ThreadCellAvatarCheckboxView.swift} (96%) diff --git a/Mail/Components/ThreadCell/ThreadCell.swift b/Mail/Components/ThreadCell/ThreadCell.swift index 6a4b85e8e..30314bd9e 100644 --- a/Mail/Components/ThreadCell/ThreadCell.swift +++ b/Mail/Components/ThreadCell/ThreadCell.swift @@ -147,7 +147,7 @@ struct ThreadCell: View { .accessibilityLabel(additionalAccessibilityLabel) .accessibilityHidden(additionalAccessibilityLabel.isEmpty) - ThreadCellCheckboxView( + ThreadCellAvatarCheckboxView( accentColor: accentColor, density: density, isSelected: isSelected, diff --git a/Mail/Components/ThreadCell/ThreadCellCheckboxView.swift b/Mail/Components/ThreadCell/ThreadCellAvatarCheckboxView.swift similarity index 96% rename from Mail/Components/ThreadCell/ThreadCellCheckboxView.swift rename to Mail/Components/ThreadCell/ThreadCellAvatarCheckboxView.swift index c3a19808f..75ebc61d0 100644 --- a/Mail/Components/ThreadCell/ThreadCellCheckboxView.swift +++ b/Mail/Components/ThreadCell/ThreadCellAvatarCheckboxView.swift @@ -19,7 +19,7 @@ import MailCore import SwiftUI -struct ThreadCellCheckboxView: View { +struct ThreadCellAvatarCheckboxView: View { @EnvironmentObject private var mailboxManager: MailboxManager let accentColor: AccentColor @@ -54,7 +54,7 @@ struct ThreadCellCheckboxView: View { } #Preview { - ThreadCellCheckboxView( + ThreadCellAvatarCheckboxView( accentColor: .pink, density: .large, isSelected: false, diff --git a/Mail/Components/ThreadCell/ThreadCellHeaderView.swift b/Mail/Components/ThreadCell/ThreadCellHeaderView.swift index fc3925451..eb6dbe69b 100644 --- a/Mail/Components/ThreadCell/ThreadCellHeaderView.swift +++ b/Mail/Components/ThreadCell/ThreadCellHeaderView.swift @@ -29,26 +29,29 @@ struct ThreadCellHeaderView: View, Equatable { var body: some View { HStack(spacing: UIPadding.small) { - if showDraftPrefix { - Text("\(MailResourcesStrings.Localizable.draftPrefix)") - .textStyle(.bodyMediumError) + HStack(spacing: UIPadding.small) { + if showDraftPrefix { + Text("\(MailResourcesStrings.Localizable.draftPrefix)") + .textStyle(.bodyMediumError) + .lineLimit(1) + .layoutPriority(1) + } + + Text(recipientsTitle) + .textStyle(.bodyMedium) .lineLimit(1) - .layoutPriority(1) - } - - Text(recipientsTitle) - .textStyle(.bodyMedium) - .lineLimit(1) - if messageCount > 1 { - ThreadCountIndicatorView(messagesCount: messageCount, hasUnseenMessages: prominentMessageCount) - .accessibilityHidden(true) + if messageCount > 1 { + ThreadCountIndicatorView(messagesCount: messageCount, hasUnseenMessages: prominentMessageCount) + .accessibilityHidden(true) + } } + .frame(maxWidth: .infinity, alignment: .leading) Text(formattedDate) .textStyle(.bodySmallSecondary) .lineLimit(1) - .frame(maxWidth: .infinity, alignment: .trailing) + .layoutPriority(1) .accessibilityHidden(true) } }