mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +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 {
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 24) {
|
||||
ForEach(news, id: \.objectID) { newsItem in
|
||||
NewsItemView(newsItem: newsItem)
|
||||
.onNewsSelection { newsItem in
|
||||
self.activeExternalUrl = newsItem.externalURL
|
||||
}
|
||||
.frame(
|
||||
maxWidth: .infinity,
|
||||
alignment: .topLeading
|
||||
)
|
||||
self.announcementsCarousel
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("From your Sources")
|
||||
.font(.title2)
|
||||
.bold()
|
||||
|
||||
LazyVStack(spacing: 24) {
|
||||
ForEach(news, id: \.objectID) { newsItem in
|
||||
NewsItemView(newsItem: newsItem)
|
||||
.onNewsSelection { newsItem in
|
||||
self.activeExternalUrl = newsItem.externalURL
|
||||
}
|
||||
.frame(
|
||||
maxWidth: .infinity,
|
||||
alignment: .topLeading
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
@@ -49,6 +57,20 @@ struct NewsView: View {
|
||||
.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() {
|
||||
AppManager.shared.fetchSources { result in
|
||||
|
||||
Reference in New Issue
Block a user