feat: adjust cell size

This commit is contained in:
dscyrescotti
2024-06-30 17:42:51 +07:00
parent 53a0993ab3
commit ecb89e6afb
2 changed files with 16 additions and 4 deletions

View File

@@ -8,13 +8,18 @@
import SwiftUI
struct MemoGrid<Card: View>: View {
let cellWidth: CGFloat = 250
let cellHeight: CGFloat = 150
@Environment(\.horizontalSizeClass) var horizontalSizeClass
let memoObjects: FetchedResults<MemoObject>
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)

View File

@@ -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()