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] {
[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 {
if let group = viewModel.tagGroup {
headerView {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text(group.description)
.font(.scaledHeadline)
ScrollView(.horizontal) {
HStack(spacing: 4) {
ForEach(group.tags, id: \.self) { tag in
Button {
routerPath.navigate(to: .hashTag(tag: tag, account: nil))
} label: {
Text("#\(tag)")
.font(.scaledHeadline)
}
.buttonStyle(.plain)
}
}
.accessibilityElement(children: .combine)
}
.scrollIndicators(.hidden)
}
}
}