Mercurial > public > geoquiz
diff GeoQuiz/Components/UserProfileHelper.swift @ 19:f140bb277c96
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 00:11:38 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Components/UserProfileHelper.swift Sun Oct 23 00:11:38 2022 +0100 @@ -0,0 +1,44 @@ +// +// UserProfileHelper.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 18/10/22. +// + +import SwiftUI + +struct UserProfile: View { + @ObservedObject var userController: UserController + @ObservedObject var storeKitController: StoreKitController + + @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 storeKitController.premiumIsActive { + Text("Premium user ⭐️") + .foregroundColor(.secondary) + } + } + + Button("Edit") { + isShowing = true + } + .buttonStyle(.borderedProminent) + } + } +} + +struct UserProfile_Previews: PreviewProvider { + static var previews: some View { + UserProfile(userController: UserController(), storeKitController: StoreKitController(), isShowing: .constant(true)) + } +}