-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathHomeView.swift
69 lines (60 loc) · 2.47 KB
/
HomeView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// HomeView.swift
// Strongbox
//
// Created by Strongbox on 28/07/2024.
// Copyright © 2024 Mark McGuill. All rights reserved.
//
import SwiftUI
struct HomeView: View {
@ObservedObject
var model: DatabaseHomeViewModel
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 25) {
if model.showFavouritesSection {
VStack(alignment: .leading, spacing: 8) {
DatabaseHomeViewHeader(title: "browse_vc_section_title_pinned", image: "star.fill", imageColor: .yellow)
FavoritesView(model: model)
}
}
if model.showNavigationSection {
VStack(alignment: .leading, spacing: 8) {
DatabaseHomeViewHeader(title: "generic_noun_navigation",
subtitle: "home_view_navigation_section_subtitle",
image: "location.fill", imageColor: .purple)
QuickNavigationView(model: model)
}
}
if model.showQuickTagsSection {
VStack(alignment: .leading, spacing: 8) {
DatabaseHomeViewHeader(title: "home_quick_tags_section_header",
subtitle: "home_view_quick_tags_section_subtitle", image: "tag.fill", imageColor: .cyan)
TagsCloudView(model: model)
}
}
if model.showOtherViews {
VStack(alignment: .leading, spacing: 8) {
DatabaseHomeViewHeader(title: "quick_view_section_title_quick_views", subtitle: "home_view_other_views_navigation_section_subtitle", image: "scope", imageColor: .blue)
OtherViewsView(model: model)
}
}
}
.padding()
}
}
}
@available(iOS 16.0, *)
#Preview {
let model = DatabaseHomeViewModel(database: SwiftDummyDatabaseModel.testModel)
@State
var searchText = ""
return NavigationStack {
HomeView(model: model)
.searchable(text: $searchText,
placement: .navigationBarDrawer(displayMode: .always),
prompt: "generic_verb_search")
.navigationTitle(model.database.nickName)
.navigationBarTitleDisplayMode(.large)
}
}