Scrollable + interactive Tag Group timeline header

This commit is contained in:
Thomas Ricouard 2023-07-19 08:30:47 +02:00
parent 3407f05003
commit bb4453c811
2 changed files with 12 additions and 11 deletions

View file

@ -79,10 +79,4 @@ public struct TagGroup: Codable, Equatable, Hashable {
public var tags: [String] { public var tags: [String] {
[main] + additional [main] + additional
} }
public var description: String {
tags
.map { "#\($0)" }
.joined(separator: " ")
}
} }

View file

@ -212,13 +212,20 @@ public struct TimelineView: View {
private var tagGroupHeaderView: some View { private var tagGroupHeaderView: some View {
if let group = viewModel.tagGroup { if let group = viewModel.tagGroup {
headerView { headerView {
HStack { ScrollView(.horizontal) {
VStack(alignment: .leading, spacing: 4) { HStack(spacing: 4) {
Text(group.description) ForEach(group.tags, id: \.self) { tag in
.font(.scaledHeadline) Button {
routerPath.navigate(to: .hashTag(tag: tag, account: nil))
} label: {
Text("#\(tag)")
.font(.scaledHeadline)
}
.buttonStyle(.plain)
}
} }
.accessibilityElement(children: .combine)
} }
.scrollIndicators(.hidden)
} }
} }
} }