diff GeoQuiz/Components/UserProfile.swift @ 20:e281791e0494

finish implementation
author Dennis C. M. <dennis@denniscm.com>
date Sun, 23 Oct 2022 11:48:39 +0100
parents GeoQuiz/Components/UserProfileHelper.swift@f140bb277c96
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GeoQuiz/Components/UserProfile.swift	Sun Oct 23 11:48:39 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 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))
+    }
+}