summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift33
1 files changed, 22 insertions, 11 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index 2b4b8c5..086d387 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -1,4 +1,5 @@
import SwiftUI
+import WaterfallGrid
struct PostGridView: View {
@EnvironmentObject var settings: SettingsManager
@@ -34,23 +35,33 @@ struct PostGridView: View {
}
let columnCount = settings.thumbnailGridColumns
- let columnsData = (0..<columnCount).map { columnIndex in
- filteredPosts.enumerated().compactMap { index, post in
- index % columnCount == columnIndex ? post : nil
+
+ if settings.alternativeThumbnailGrid {
+ WaterfallGrid(filteredPosts, id: \.id) { post in
+ waterfallGridContent(post: post)
+ .id(post.id)
+ }
+ .gridStyle(columns: columnCount)
+ .padding(.horizontal)
+ } else {
+ let columnsData = (0..<columnCount).map { columnIndex in
+ filteredPosts.enumerated().compactMap { index, post in
+ index % columnCount == columnIndex ? post : nil
+ }
}
- }
- HStack(alignment: .top) {
- ForEach(0..<columnCount, id: \.self) { columnIndex in
- LazyVStack {
- ForEach(columnsData[columnIndex], id: \.id) { post in
- waterfallGridContent(post: post)
- .id(post.id)
+ HStack(alignment: .top) {
+ ForEach(0..<columnCount, id: \.self) { columnIndex in
+ LazyVStack {
+ ForEach(columnsData[columnIndex], id: \.id) { post in
+ waterfallGridContent(post: post)
+ .id(post.id)
+ }
}
}
}
+ .padding(.horizontal)
}
- .padding(.horizontal)
}
.opacity(isActive ? 1 : 0)
.frame(height: isActive ? nil : 0)