1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import SwiftUI
struct AccountSummaryRow<Header: View>: View {
@AppStorage("hideAvatars") private var hideAvatars = false
@AppStorage("handlesOnly") private var handlesOnly = false
let author: Post.Author
let bio: String?
let avatarIdentifier: String
let contentIdentifier: String
let openProfile: () -> Void
@ViewBuilder let header: () -> Header
var body: some View {
HStack(alignment: .top, spacing: 12) {
if !hideAvatars {
Button(action: openProfile) {
AuthorAvatar(author: author, size: 42)
.frame(minWidth: 44, minHeight: 44)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.accessibilityLabel("View \(DisplayPreferences(handlesOnly: handlesOnly).name(author))'s profile")
.accessibilityIdentifier(avatarIdentifier)
}
Button(action: openProfile) {
VStack(alignment: .leading, spacing: 8) {
header()
if let bio, !bio.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Text(bio)
.appFont(.subheadline)
.foregroundStyle(.primary)
.fixedSize(horizontal: false, vertical: true)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.multilineTextAlignment(.leading)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.accessibilityHint("Opens this account profile")
.accessibilityIdentifier(contentIdentifier)
}
}
}