mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-05-19 14:17:14 +02:00
feat: fine tune navigation title
This commit is contained in:
@@ -8,23 +8,25 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct Placeholder: View {
|
struct Placeholder: View {
|
||||||
|
@Environment(\.horizontalSizeClass) var horizontalSizeClass
|
||||||
|
|
||||||
let info: Info
|
let info: Info
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 15) {
|
VStack(spacing: 15) {
|
||||||
|
let iconSize: CGFloat = horizontalSizeClass == .compact ? 40 : 50
|
||||||
Image(systemName: info.icon)
|
Image(systemName: info.icon)
|
||||||
.font(.system(size: 50))
|
.font(.system(size: iconSize))
|
||||||
.frame(width: 55, height: 55)
|
.frame(width: iconSize * 1.1, height: iconSize * 1.1)
|
||||||
VStack(spacing: 3) {
|
VStack(spacing: 3) {
|
||||||
Text(info.title)
|
Text(info.title)
|
||||||
.font(.title2)
|
.font(horizontalSizeClass == .compact ? .headline : .title2)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.foregroundStyle(.primary)
|
.foregroundStyle(.primary)
|
||||||
Text(info.description)
|
Text(info.description)
|
||||||
.font(.callout)
|
.font(horizontalSizeClass == .compact ? .caption : .callout)
|
||||||
.lineLimit(.none)
|
.lineLimit(.none)
|
||||||
.fontWeight(.regular)
|
.fontWeight(.regular)
|
||||||
.frame(minHeight: 50, alignment: .top)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|||||||
@@ -45,16 +45,11 @@ struct MemosView: View {
|
|||||||
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
|
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
|
||||||
memoCard(memoObject)
|
memoCard(memoObject)
|
||||||
}
|
}
|
||||||
|
.navigationTitle(horizontalSizeClass == .compact ? "Memos" : "")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
|
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
|
||||||
.toolbar {
|
.toolbar {
|
||||||
if horizontalSizeClass == .compact {
|
if horizontalSizeClass == .regular {
|
||||||
ToolbarItem(placement: .principal) {
|
|
||||||
Text("Memos")
|
|
||||||
.font(.title3)
|
|
||||||
.fontWeight(.bold)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToolbarItem(placement: .topBarLeading) {
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
Text("Memola")
|
Text("Memola")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
|
|||||||
@@ -45,16 +45,11 @@ struct TrashView: View {
|
|||||||
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
|
MemoGrid(memoObjects: memoObjects, placeholder: placeholder) { memoObject in
|
||||||
memoCard(memoObject)
|
memoCard(memoObject)
|
||||||
}
|
}
|
||||||
|
.navigationTitle(horizontalSizeClass == .compact ? "Trash" : "")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
|
.searchable(text: $query, placement: .toolbar, prompt: Text("Search"))
|
||||||
.toolbar {
|
.toolbar {
|
||||||
if horizontalSizeClass == .compact {
|
if horizontalSizeClass == .regular {
|
||||||
ToolbarItem(placement: .principal) {
|
|
||||||
Text("Trash")
|
|
||||||
.font(.title3)
|
|
||||||
.fontWeight(.bold)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ToolbarItem(placement: .topBarLeading) {
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
Text("Memola")
|
Text("Memola")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ struct Sidebar: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
List(selection: $sidebarItem) {
|
List(selection: $sidebarItem) {
|
||||||
ForEach(sidebarItems) { item in
|
ForEach(sidebarItems) { item in
|
||||||
|
if horizontalSizeClass == .compact {
|
||||||
|
Button {
|
||||||
|
sidebarItem = item
|
||||||
|
} label: {
|
||||||
|
Label(item.title, systemImage: item.icon)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Button {
|
Button {
|
||||||
sidebarItem = item
|
sidebarItem = item
|
||||||
} label: {
|
} label: {
|
||||||
@@ -26,6 +34,7 @@ struct Sidebar: View {
|
|||||||
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.listStyle(.sidebar)
|
.listStyle(.sidebar)
|
||||||
.navigationTitle(horizontalSizeClass == .compact ? "Memola" : "")
|
.navigationTitle(horizontalSizeClass == .compact ? "Memola" : "")
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
|
|||||||
Reference in New Issue
Block a user