mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-20 04:03:26 +01:00
[ADD] Carousel for SideStore-specific announcements in NewsView
This commit is contained in:
@@ -26,6 +26,13 @@ struct NewsView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
self.announcementsCarousel
|
||||||
|
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text("From your Sources")
|
||||||
|
.font(.title2)
|
||||||
|
.bold()
|
||||||
|
|
||||||
LazyVStack(spacing: 24) {
|
LazyVStack(spacing: 24) {
|
||||||
ForEach(news, id: \.objectID) { newsItem in
|
ForEach(news, id: \.objectID) { newsItem in
|
||||||
NewsItemView(newsItem: newsItem)
|
NewsItemView(newsItem: newsItem)
|
||||||
@@ -38,6 +45,7 @@ struct NewsView: View {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
.background(Color(UIColor.systemGroupedBackground).ignoresSafeArea())
|
.background(Color(UIColor.systemGroupedBackground).ignoresSafeArea())
|
||||||
@@ -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