Use NavigationLink with value to push Explore trending links" (#1594)
- Fixes trending links "see more" not getting added to navigation path.
This commit is contained in:
parent
1f28595d39
commit
1f44c502dd
|
@ -55,6 +55,8 @@ extension View {
|
|||
selectedTagGroup: .constant(nil),
|
||||
scrollToTopSignal: .constant(0),
|
||||
canFilterTimeline: false)
|
||||
case let .trendingLinks(cards):
|
||||
CardsListView(cards: cards)
|
||||
case let .tagsList(tags):
|
||||
TagsListView(tags: tags)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public enum RouterDestination: Hashable {
|
|||
case rebloggedBy(id: String)
|
||||
case accountsList(accounts: [Account])
|
||||
case trendingTimeline
|
||||
case trendingLinks(cards: [Card])
|
||||
case tagsList(tags: [Tag])
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import DesignSystem
|
||||
import Models
|
||||
import Status
|
||||
import SwiftUI
|
||||
|
||||
public struct CardsListView: View {
|
||||
@Environment(Theme.self) private var theme
|
||||
|
||||
let cards: [Card]
|
||||
|
||||
public init(cards: [Card]) {
|
||||
self.cards = cards
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
List {
|
||||
ForEach(cards) { card in
|
||||
StatusRowCardView(card: card)
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(theme.primaryBackgroundColor)
|
||||
.listStyle(.plain)
|
||||
.navigationTitle("explore.section.trending.links")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
|
@ -226,20 +226,8 @@ public struct ExploreView: View {
|
|||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
NavigationLink {
|
||||
List {
|
||||
ForEach(viewModel.trendingLinks) { card in
|
||||
StatusRowCardView(card: card)
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(theme.primaryBackgroundColor)
|
||||
.listStyle(.plain)
|
||||
.navigationTitle("explore.section.trending.links")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} label: {
|
||||
|
||||
NavigationLink(value: RouterDestination.trendingLinks(cards: viewModel.trendingLinks)) {
|
||||
Text("see-more")
|
||||
.foregroundColor(theme.tintColor)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue