-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeTitleView.swift
80 lines (68 loc) · 1.87 KB
/
HomeTitleView.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
70
71
72
73
74
75
76
77
78
79
80
//
// HomeTitleView.swift
// Shoo
//
// Created by Alexander Schiff on 6/1/20.
// Copyright © 2020 Alexander Schiff. All rights reserved.
//
import SwiftUI
struct HomeTitleView: View {
@EnvironmentObject var fire: Fire
var date: String{
let now = Date()
let formatter = DateFormatter()
//weekday
formatter.dateFormat = "EEEE"
let weekday = formatter.string(from: now)
//month
formatter.dateFormat = "LLLL"
let month = formatter.string(from: now)
//day
let day = Calendar.current.dateComponents([.day], from: now).day
return "\(weekday), \(month) \(day!)"
}
@Binding var sheetType: presentSheet
@Binding var showSheet: Bool
var body: some View {
VStack(alignment: .leading, spacing: 0){
//FreePeopleView().environmentObject(self.fire)
Text(date.uppercased())
.font(.system(size: 12, weight: .semibold))
.foregroundColor(.secondary)
.lineLimit(1)
HStack{
Button(action: {
buttonPressHaptic(self.fire.reduceHaptics)
self.sheetType = .settings
self.showSheet = true
}){
HStack{
Text(self.fire.houseName)
.font(.system(size: 30, weight: .bold))
.lineLimit(1)
.foregroundColor(.primary)
Image(systemName: "chevron.right")
.font(.system(size: 20))
.foregroundColor(.primary)
}
}
Spacer()
Button(action: {
buttonPressHaptic(self.fire.reduceHaptics)
self.sheetType = .editHouse
self.showSheet = true
}){
Image(systemName: "person.crop.circle.fill.badge.plus")
.font(.system(size: 30))
.foregroundColor(.primary)
}
}
}
.padding(.horizontal)
}
}
struct HomeTitleView_Previews: PreviewProvider {
static var previews: some View {
HomeTitleView(sheetType: .constant(.editHouse), showSheet: .constant(false)).environmentObject(Fire())
}
}