feat: fine tune navigation title

This commit is contained in:
dscyrescotti
2024-06-30 01:25:27 +07:00
parent 542d3ea9d6
commit 53a0993ab3
4 changed files with 124 additions and 123 deletions
@@ -8,23 +8,25 @@
import SwiftUI
struct Placeholder: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
let info: Info
var body: some View {
VStack(spacing: 15) {
let iconSize: CGFloat = horizontalSizeClass == .compact ? 40 : 50
Image(systemName: info.icon)
.font(.system(size: 50))
.frame(width: 55, height: 55)
.font(.system(size: iconSize))
.frame(width: iconSize * 1.1, height: iconSize * 1.1)
VStack(spacing: 3) {
Text(info.title)
.font(.title2)
.font(horizontalSizeClass == .compact ? .headline : .title2)
.fontWeight(.bold)
.foregroundStyle(.primary)
Text(info.description)
.font(.callout)
.font(horizontalSizeClass == .compact ? .caption : .callout)
.lineLimit(.none)
.fontWeight(.regular)
.frame(minHeight: 50, alignment: .top)
}
}
.foregroundStyle(.secondary)
@@ -45,16 +45,11 @@ struct MemosView: View {
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
memoCard(memoObject)
}
.navigationTitle(horizontalSizeClass == .compact ? "Memos" : "")
.navigationBarTitleDisplayMode(.inline)
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
.toolbar {
if horizontalSizeClass == .compact {
ToolbarItem(placement: .principal) {
Text("Memos")
.font(.title3)
.fontWeight(.bold)
}
} else {
if horizontalSizeClass == .regular {
ToolbarItem(placement: .topBarLeading) {
Text("Memola")
.font(.title3)
@@ -45,16 +45,11 @@ struct TrashView: View {
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
memoCard(memoObject)
}
.navigationTitle(horizontalSizeClass == .compact ? "Trash" : "")
.navigationBarTitleDisplayMode(.inline)
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
.toolbar {
if horizontalSizeClass == .compact {
ToolbarItem(placement: .principal) {
Text("Trash")
.font(.title3)
.fontWeight(.bold)
}
} else {
if horizontalSizeClass == .regular {
ToolbarItem(placement: .topBarLeading) {
Text("Memola")
.font(.title3)
@@ -16,6 +16,14 @@ struct Sidebar: View {
var body: some View {
List(selection: $sidebarItem) {
ForEach(sidebarItems) { item in
if horizontalSizeClass == .compact {
Button {
sidebarItem = item
} label: {
Label(item.title, systemImage: item.icon)
.foregroundColor(.primary)
}
} else {
Button {
sidebarItem = item
} label: {
@@ -26,6 +34,7 @@ struct Sidebar: View {
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
}
}
}
.listStyle(.sidebar)
.navigationTitle(horizontalSizeClass == .compact ? "Memola" : "")
.scrollContentBackground(.hidden)