Mercurial > public > geoquiz
comparison GeoQuiz/Helpers/UserProfile.swift @ 26:425078c01194
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 09 Nov 2022 10:30:01 +0100 |
parents | GeoQuiz/Components/UserProfile.swift@e281791e0494 |
children |
comparison
equal
deleted
inserted
replaced
25:b3df0f5dc750 | 26:425078c01194 |
---|---|
1 // | |
2 // UserProfile.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 18/10/22. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct UserProfile: View { | |
11 @ObservedObject var userController: UserController | |
12 @ObservedObject var storeController: StoreController | |
13 | |
14 @Binding var isShowing: Bool | |
15 | |
16 var body: some View { | |
17 VStack(spacing: 20) { | |
18 UserImage(userController: userController) | |
19 .frame(height: 150) | |
20 .shadow(radius: 10) | |
21 | |
22 VStack(spacing: 10) { | |
23 Text(userController.data.username) | |
24 .font(.title.bold()) | |
25 | |
26 if storeController.premiumIsActive { | |
27 Text("Premium user ⭐️") | |
28 .foregroundColor(.secondary) | |
29 } | |
30 } | |
31 | |
32 Button("Edit") { | |
33 isShowing = true | |
34 } | |
35 .buttonStyle(.borderedProminent) | |
36 } | |
37 } | |
38 } | |
39 | |
40 struct UserProfile_Previews: PreviewProvider { | |
41 static var previews: some View { | |
42 UserProfile(userController: UserController(), storeController: StoreController(), isShowing: .constant(true)) | |
43 } | |
44 } |