-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathDatabaseHomeViewHeader.swift
54 lines (47 loc) · 1.46 KB
/
DatabaseHomeViewHeader.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
//
// DatabaseHomeViewHeader.swift
// Strongbox
//
// Created by Strongbox on 27/07/2024.
// Copyright © 2024 Mark McGuill. All rights reserved.
//
import Foundation
import SwiftUI
struct DatabaseHomeViewHeader: View {
var title: LocalizedStringKey
var subtitle: LocalizedStringKey?
var image: String
var imageColor: Color
var body: some View {
if #available(iOS 16.0, *) {
HStack(spacing: 4) {
Image(systemName: image)
.foregroundColor(imageColor)
.font(.title3)
.fontWeight(.bold)
VStack(alignment: .leading, spacing: 2) {
Text(title)
.lineLimit(2)
.font(.title3)
.fontWeight(.bold)
if let subtitle {
Text(subtitle)
.lineLimit(2)
.font(.caption)
.foregroundStyle(.secondary)
}
}
}
} else {
HStack(spacing: 4) {
Image(systemName: image)
.foregroundColor(imageColor)
Text(title)
}
.font(.title3)
}
}
}
#Preview {
DatabaseHomeViewHeader(title: "generic_noun_navigation", subtitle: "Find your way around your database.", image: "location.fill", imageColor: .purple)
}