Colors, pages, post links
This commit is contained in:
@@ -13,20 +13,18 @@ private struct CenteredPost<Content>: View where Content: View {
|
||||
HorizontalCenter {
|
||||
content
|
||||
}
|
||||
.listRowBackground(PostList.background)
|
||||
.listRowBackground(ColorPalette.listBackground)
|
||||
}
|
||||
}
|
||||
|
||||
struct PostList: View {
|
||||
|
||||
static let background = Color(r: 2, g: 15, b: 26)
|
||||
|
||||
@Binding
|
||||
var posts: [Post]
|
||||
@EnvironmentObject
|
||||
private var content: Content
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
if posts.isEmpty {
|
||||
if content.posts.isEmpty {
|
||||
CenteredPost {
|
||||
Text("No posts yet.")
|
||||
.padding()
|
||||
@@ -40,7 +38,7 @@ struct PostList: View {
|
||||
.padding()
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
ForEach(posts) { post in
|
||||
ForEach(content.posts) { post in
|
||||
CenteredPost {
|
||||
PostView(post: post)
|
||||
.frame(maxWidth: 600)
|
||||
@@ -50,7 +48,7 @@ struct PostList: View {
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.background(PostList.background)
|
||||
.background(ColorPalette.listBackground)
|
||||
.scrollContentBackground(.hidden)
|
||||
}
|
||||
|
||||
@@ -64,10 +62,11 @@ struct PostList: View {
|
||||
tags: [],
|
||||
german: .init(title: "Titel", content: "Text"),
|
||||
english: .init(title: "Title", content: "Text"))
|
||||
posts.insert(post, at: 0)
|
||||
content.posts.insert(post, at: 0)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
PostList(posts: .constant([.mock, .fullMock]))
|
||||
PostList()
|
||||
.environmentObject(Content())
|
||||
}
|
||||
|
Reference in New Issue
Block a user