mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 10:11:00 +00:00
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
4 changed files with 34 additions and 14 deletions
|
@ -55,6 +55,8 @@ extension View {
|
||||||
selectedTagGroup: .constant(nil),
|
selectedTagGroup: .constant(nil),
|
||||||
scrollToTopSignal: .constant(0),
|
scrollToTopSignal: .constant(0),
|
||||||
canFilterTimeline: false)
|
canFilterTimeline: false)
|
||||||
|
case let .trendingLinks(cards):
|
||||||
|
CardsListView(cards: cards)
|
||||||
case let .tagsList(tags):
|
case let .tagsList(tags):
|
||||||
TagsListView(tags: tags)
|
TagsListView(tags: tags)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public enum RouterDestination: Hashable {
|
||||||
case rebloggedBy(id: String)
|
case rebloggedBy(id: String)
|
||||||
case accountsList(accounts: [Account])
|
case accountsList(accounts: [Account])
|
||||||
case trendingTimeline
|
case trendingTimeline
|
||||||
|
case trendingLinks(cards: [Card])
|
||||||
case tagsList(tags: [Tag])
|
case tagsList(tags: [Tag])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
Packages/Explore/Sources/Explore/CardsListView.swift
Normal file
29
Packages/Explore/Sources/Explore/CardsListView.swift
Normal file
|
@ -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)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
NavigationLink {
|
|
||||||
List {
|
NavigationLink(value: RouterDestination.trendingLinks(cards: viewModel.trendingLinks)) {
|
||||||
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: {
|
|
||||||
Text("see-more")
|
Text("see-more")
|
||||||
.foregroundColor(theme.tintColor)
|
.foregroundColor(theme.tintColor)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue