diff --git a/Memola/Features/Dashboard/Details/Shared/MemoGrid.swift b/Memola/Features/Dashboard/Details/Shared/MemoGrid.swift index 09fb23e..e443f53 100644 --- a/Memola/Features/Dashboard/Details/Shared/MemoGrid.swift +++ b/Memola/Features/Dashboard/Details/Shared/MemoGrid.swift @@ -8,13 +8,18 @@ import SwiftUI struct MemoGrid: View { - let cellWidth: CGFloat = 250 - let cellHeight: CGFloat = 150 - + @Environment(\.horizontalSizeClass) var horizontalSizeClass let memoObjects: FetchedResults let placeholder: Placeholder.Info @ViewBuilder let card: (MemoObject) -> Card + var cellWidth: CGFloat { + if horizontalSizeClass == .compact { + return 180 + } + return 250 + } + var body: some View { if memoObjects.isEmpty { Placeholder(info: placeholder) diff --git a/Memola/Features/Dashboard/Details/Shared/MemoPreview.swift b/Memola/Features/Dashboard/Details/Shared/MemoPreview.swift index 2d0418c..6ec7f01 100644 --- a/Memola/Features/Dashboard/Details/Shared/MemoPreview.swift +++ b/Memola/Features/Dashboard/Details/Shared/MemoPreview.swift @@ -8,7 +8,14 @@ import SwiftUI struct MemoPreview: View { - let cellHeight: CGFloat = 150 + @Environment(\.horizontalSizeClass) var horizontalSizeClass + + var cellHeight: CGFloat { + if horizontalSizeClass == .compact { + return 120 + } + return 150 + } var body: some View { Rectangle()