@@ -11,12 +11,24 @@ import SwiftUI
11
11
struct Home : View {
12
12
13
13
@State var show = false
14
+ @State var showProfile = false
14
15
15
16
var body : some View {
16
17
ZStack {
17
- Button ( action: { self . show. toggle ( ) } ) {
18
- Text ( " Open Menu " )
19
- }
18
+ ContentView ( )
19
+ . background ( Color . white)
20
+ . cornerRadius ( 30 )
21
+ . shadow ( radius: 20 )
22
+ . animation ( . fluidSpring( ) )
23
+ . offset ( y: showProfile ? 40 : UIScreen . main. bounds. height)
24
+
25
+ MenuButton ( show: $show)
26
+ . offset ( x: - 30 , y: showProfile ? 0 : 80 )
27
+ . animation ( . fluidSpring( ) )
28
+
29
+ MenuRight ( show: $showProfile)
30
+ . offset ( x: - 16 , y: showProfile ? 0 : 88 )
31
+
20
32
MenuView ( show: $show)
21
33
}
22
34
}
@@ -90,3 +102,61 @@ struct MenuView: View {
90
102
}
91
103
}
92
104
}
105
+
106
+ struct CircleButton : View {
107
+
108
+ var icon = " person.crop.circle "
109
+
110
+ var body : some View {
111
+ return HStack {
112
+ Image ( systemName: icon)
113
+ . foregroundColor ( . black)
114
+ }
115
+ . frame ( width: 44 , height: 44 )
116
+ . background ( Color . white)
117
+ . cornerRadius ( 30 )
118
+ . shadow ( color: Color ( " buttonShadow " ) , radius: 20 , x: 0 , y: 20 )
119
+ }
120
+ }
121
+
122
+ struct MenuButton : View {
123
+ @Binding var show : Bool
124
+
125
+ var body : some View {
126
+ return ZStack ( alignment: . topLeading) {
127
+ Button ( action: { self . show. toggle ( ) } ) {
128
+ HStack {
129
+ Spacer ( )
130
+
131
+ Image ( systemName: " list.dash " )
132
+ . foregroundColor ( . black)
133
+ }
134
+ . padding ( . trailing, 20 )
135
+ . frame ( width: 90 , height: 60 )
136
+ . background ( Color . white)
137
+ . cornerRadius ( 30 )
138
+ . shadow ( color: Color ( " buttonShadow " ) , radius: 20 , x: 0 , y: 20 )
139
+ }
140
+ Spacer ( )
141
+ }
142
+ }
143
+ }
144
+
145
+ struct MenuRight : View {
146
+
147
+ @Binding var show : Bool
148
+
149
+ var body : some View {
150
+ return ZStack ( alignment: . topTrailing) {
151
+ HStack {
152
+ Button ( action: { self . show. toggle ( ) } ) {
153
+ CircleButton ( icon: " person.crop.circle " )
154
+ }
155
+ Button ( action: { self . show. toggle ( ) } ) {
156
+ CircleButton ( icon: " bell " )
157
+ }
158
+ }
159
+ Spacer ( )
160
+ }
161
+ }
162
+ }
0 commit comments