mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 03:33:36 +01:00
[ADD] Carousel for SideStore-specific announcements in NewsView
This commit is contained in:
committed by
Joe Mattiello
parent
02e48a207f
commit
497c048240
@@ -26,16 +26,24 @@ struct NewsView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVStack(spacing: 24) {
|
self.announcementsCarousel
|
||||||
ForEach(news, id: \.objectID) { newsItem in
|
|
||||||
NewsItemView(newsItem: newsItem)
|
VStack(alignment: .leading) {
|
||||||
.onNewsSelection { newsItem in
|
Text("From your Sources")
|
||||||
self.activeExternalUrl = newsItem.externalURL
|
.font(.title2)
|
||||||
}
|
.bold()
|
||||||
.frame(
|
|
||||||
maxWidth: .infinity,
|
LazyVStack(spacing: 24) {
|
||||||
alignment: .topLeading
|
ForEach(news, id: \.objectID) { newsItem in
|
||||||
)
|
NewsItemView(newsItem: newsItem)
|
||||||
|
.onNewsSelection { newsItem in
|
||||||
|
self.activeExternalUrl = newsItem.externalURL
|
||||||
|
}
|
||||||
|
.frame(
|
||||||
|
maxWidth: .infinity,
|
||||||
|
alignment: .topLeading
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
@@ -49,6 +57,20 @@ struct NewsView: View {
|
|||||||
.onAppear(perform: fetchNews)
|
.onAppear(perform: fetchNews)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var announcementsCarousel: some View {
|
||||||
|
TabView {
|
||||||
|
ForEach(0..<5) { _ in
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.shadow(radius: 5, y: 3)
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tabViewStyle(PageTabViewStyle())
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.aspectRatio(16/9, contentMode: .fit)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func fetchNews() {
|
func fetchNews() {
|
||||||
AppManager.shared.fetchSources { result in
|
AppManager.shared.fetchSources { result in
|
||||||
|
|||||||
Reference in New Issue
Block a user