-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathQuoteView.swift
63 lines (48 loc) · 1.6 KB
/
QuoteView.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
// Kevin Li - 3:47 PM - 6/29/20
import SwiftUI
struct QuoteView: View {
@Environment(\.appTheme) private var appTheme: AppTheme
@ObservedObject var quoteState: QuoteState
var body: some View {
HStack(spacing: 0) {
Spacer()
.frame(width: Constants.List.sideBarWidth + Constants.List.sideBarPadding)
quotePreviewBlock
}
}
}
private extension QuoteView {
var quotePreviewBlock: some View {
ZStack(alignment: .leading) {
appTheme.primary
.edgesIgnoringSafeArea(.vertical)
VStack(alignment: .leading) {
headerQuoteText
.opacity(quoteState.shouldShowHeader ? 1 : 0)
Spacer()
footerQuoteText
.opacity(quoteState.shouldShowFooter ? 1 : 0)
}
.padding(.horizontal, 24)
.offset(y: quoteState.headerFooterOffset)
}
}
var headerQuoteText: some View {
VStack(alignment: .leading) {
Text("If you're not failing, you're probably not really moving forward.")
.font(.footnote)
Text("-John Maxwell")
.font(.caption)
.italic()
}
}
var footerQuoteText: some View {
VStack(alignment: .leading) {
Text("Why worry about things you can't control when you can keep yourself busy controlling the things that depend on you?")
.font(.footnote)
Text("-John Maxwell")
.font(.caption)
.italic()
}
}
}