-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhiteCard.swift
131 lines (108 loc) · 5.03 KB
/
WhiteCard.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// WhiteCard.swift
// AchievementUICase
//
// Created by Jevon Charles on 9/9/20.
// Copyright © 2020 Jevon Charles. All rights reserved.
//
import SwiftUI
struct WhiteCard: View {
var height: CGFloat
var width: CGFloat
@State var indictorPosition: CGFloat = 0
var body: some View {
ZStack {
Color.white
.frame(height: height * 0.75)
.cornerRadius(45, corners: [.topLeft, .topRight])
VStack(spacing: 0) {
VStack(alignment: .leading) {
HStack(alignment: .lastTextBaseline) {
Image(systemName: "rosette")
.frame(maxWidth: .infinity)
.onTapGesture {
self.indictorPosition = 0
}
Image(systemName: "bell.circle")
.frame(maxWidth: .infinity)
.onTapGesture {
self.indictorPosition = 0 + self.width * 0.33
}
Text("5 of 20")
.font(.body)
.frame(maxWidth: .infinity)
.onTapGesture {
self.indictorPosition = self.width - self.width * 0.33
}
}
.font(.title)
.foregroundColor(.primary)
.padding(.top, 30)
Color("Cyclamen")
.frame(width: width * 0.33, height: 4)
.cornerRadius(10)
.offset(x: indictorPosition)
.animation(.easeInOut)
}
// Spacer()
GeometryReader { bottomGeo in
VStack(spacing: 0) {
HStack(spacing: 0) {
ZStack {
Color.white
.frame(width: bottomGeo.size.width * 0.5, height: bottomGeo.size.height * 0.5)
.border(Color.gray.opacity(0.2))
Circle()
.foregroundColor(Color("Cyclamen"))
.opacity(0.3)
.padding()
Text("👋🏾")
.font(.largeTitle)
}
ZStack {
Color.white
.frame(width: bottomGeo.size.width * 0.5, height: bottomGeo.size.height * 0.5)
.border(Color.gray.opacity(0.2))
Circle()
.foregroundColor(.blue)
.opacity(0.3)
.padding()
Text("🧠")
.font(.largeTitle)
}
}
HStack(spacing: 0) {
ZStack {
Color.white
.frame(width: bottomGeo.size.width * 0.5, height: bottomGeo.size.height * 0.5)
.border(Color.gray.opacity(0.2))
Circle()
.foregroundColor(.green)
.opacity(0.3)
.padding()
Text("👩🏿🦰")
.font(.largeTitle)
}
ZStack {
Color.white
.frame(width: bottomGeo.size.width * 0.5, height: bottomGeo.size.height * 0.5)
.border(Color.gray.opacity(0.2))
Circle()
.foregroundColor(.red)
.opacity(0.3)
.padding()
Text("👨🏿💻")
.font(.largeTitle)
}
}
}
}
}
}
}
}
struct WhiteCard_Previews: PreviewProvider {
static var previews: some View {
WhiteCard(height: 300, width: 400)
}
}