8
8
9
9
import SwiftUI
10
10
11
+ let statusBarHeight = UIApplication . shared. statusBarFrame. height
12
+ let screen = UIScreen . main. bounds
13
+
11
14
struct Home : View {
12
15
13
16
@State var show = false
@@ -21,20 +24,23 @@ struct Home: View {
21
24
. animation ( . default)
22
25
23
26
ContentView ( )
27
+ . frame ( minWidth: 0 , maxWidth: 712 )
24
28
. cornerRadius ( 30 )
25
29
. shadow ( radius: 20 )
26
30
. animation ( . fluidSpring( ) )
27
- . offset ( y: showProfile ? 40 : UIScreen . main. bounds. height)
31
+ . offset ( y: showProfile ? statusBarHeight + 40 : UIScreen . main. bounds. height)
28
32
29
33
MenuButton ( show: $show)
30
- . offset ( x: - 30 , y: showProfile ? 0 : 80 )
34
+ . offset ( x: - 40 , y: showProfile ? statusBarHeight : 80 )
31
35
. animation ( . fluidSpring( ) )
32
36
33
37
MenuRight ( show: $showProfile)
34
- . offset ( x: - 16 , y: showProfile ? 0 : 88 )
38
+ . offset ( x: - 16 , y: showProfile ? statusBarHeight : 88 )
35
39
36
40
MenuView ( show: $show)
37
41
}
42
+ . background ( Color ( " background " ) )
43
+ . edgesIgnoringSafeArea ( . all)
38
44
}
39
45
}
40
46
@@ -60,6 +66,7 @@ struct MenuRow: View {
60
66
61
67
Text ( text)
62
68
. font ( . headline)
69
+ . color ( . primary)
63
70
64
71
Spacer ( )
65
72
}
@@ -74,6 +81,7 @@ struct Menu: Identifiable {
74
81
75
82
let menuData = [
76
83
Menu ( title: " My Account " , icon: " person.crop.circle " ) ,
84
+ Menu ( title: " Settings " , icon: " gear " ) ,
77
85
Menu ( title: " Billing " , icon: " creditcard " ) ,
78
86
Menu ( title: " Team " , icon: " person.and.person " ) ,
79
87
Menu ( title: " Sign out " , icon: " arrow.uturn.down " )
@@ -85,25 +93,35 @@ struct MenuView: View {
85
93
@Binding var show : Bool
86
94
87
95
var body : some View {
88
- return VStack ( alignment: . leading) {
89
- ForEach ( menu) { item in
90
- MenuRow ( image: item. icon, text: item. title)
96
+ return HStack {
97
+ VStack ( alignment: . leading) {
98
+ ForEach ( menu) { item in
99
+ if item. title == " Settings " {
100
+ PresentationLink ( destination: Settings ( ) ) {
101
+ MenuRow ( image: item. icon, text: item. title)
102
+ }
103
+ } else {
104
+ MenuRow ( image: item. icon, text: item. title)
105
+ }
106
+ }
107
+ Spacer ( )
108
+ }
109
+ . padding ( . top, 20 )
110
+ . padding ( 30 )
111
+ . frame ( minWidth: 0 , maxWidth: 360 )
112
+ . background ( Color ( " button " ) )
113
+ . cornerRadius ( 30 )
114
+ . padding ( . trailing, 60 )
115
+ . shadow ( radius: 20 )
116
+ . rotation3DEffect ( Angle ( degrees: show ? 0 : 60 ) , axis: ( x: 0 , y: 10.0 , z: 0 ) )
117
+ . animation ( . basic( ) )
118
+ . offset ( x: show ? 0 : - UIScreen. main. bounds. width)
119
+ . tapAction {
120
+ self . show. toggle ( )
91
121
}
92
122
Spacer ( )
93
123
}
94
- . padding ( . top, 20 )
95
- . padding ( 30 )
96
- . frame ( minWidth: 0 , maxWidth: . infinity)
97
- . background ( BlurView ( style: . systemMaterial) )
98
- . cornerRadius ( 30 )
99
- . padding ( . trailing, 60 )
100
- . shadow ( radius: 20 )
101
- . rotation3DEffect ( Angle ( degrees: show ? 0 : 60 ) , axis: ( x: 0 , y: 10.0 , z: 0 ) )
102
- . animation ( . basic( ) )
103
- . offset ( x: show ? 0 : - UIScreen. main. bounds. width)
104
- . tapAction {
105
- self . show. toggle ( )
106
- }
124
+ . padding ( . top, statusBarHeight)
107
125
}
108
126
}
109
127
@@ -117,7 +135,7 @@ struct CircleButton: View {
117
135
. foregroundColor ( . primary)
118
136
}
119
137
. frame ( width: 44 , height: 44 )
120
- . background ( BlurView ( style : . systemThickMaterial ) )
138
+ . background ( Color ( " button " ) )
121
139
. cornerRadius ( 30 )
122
140
. shadow ( color: Color ( " buttonShadow " ) , radius: 20 , x: 0 , y: 20 )
123
141
}
@@ -135,9 +153,9 @@ struct MenuButton: View {
135
153
Image ( systemName: " list.dash " )
136
154
. foregroundColor ( . primary)
137
155
}
138
- . padding ( . trailing, 20 )
156
+ . padding ( . trailing, 18 )
139
157
. frame ( width: 90 , height: 60 )
140
- . background ( BlurView ( style : . systemThickMaterial ) )
158
+ . background ( Color ( " button " ) )
141
159
. cornerRadius ( 30 )
142
160
. shadow ( color: Color ( " buttonShadow " ) , radius: 20 , x: 0 , y: 20 )
143
161
}
@@ -156,7 +174,7 @@ struct MenuRight: View {
156
174
Button ( action: { self . show. toggle ( ) } ) {
157
175
CircleButton ( icon: " person.crop.circle " )
158
176
}
159
- Button ( action : { self . show . toggle ( ) } ) {
177
+ PresentationLink ( destination : UpdateList ( ) ) {
160
178
CircleButton ( icon: " bell " )
161
179
}
162
180
}
0 commit comments