Mercurial > public > geoquiz
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Helpers/UserProfile.swift Wed Nov 09 10:30:01 2022 +0100 @@ -0,0 +1,44 @@ +// +// UserProfile.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 18/10/22. +// + +import SwiftUI + +struct UserProfile: View { + @ObservedObject var userController: UserController + @ObservedObject var storeController: StoreController + + @Binding var isShowing: Bool + + var body: some View { + VStack(spacing: 20) { + UserImage(userController: userController) + .frame(height: 150) + .shadow(radius: 10) + + VStack(spacing: 10) { + Text(userController.data.username) + .font(.title.bold()) + + if storeController.premiumIsActive { + Text("Premium user ⭐️") + .foregroundColor(.secondary) + } + } + + Button("Edit") { + isShowing = true + } + .buttonStyle(.borderedProminent) + } + } +} + +struct UserProfile_Previews: PreviewProvider { + static var previews: some View { + UserProfile(userController: UserController(), storeController: StoreController(), isShowing: .constant(true)) + } +}