Mercurial > public > geoquiz
diff GeoQuiz/Components/UserProfileComponent.swift @ 16:1011e56b7832
implement user profile
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 20 Oct 2022 13:49:42 +0200 |
parents | |
children | 8dac58bb4569 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Components/UserProfileComponent.swift Thu Oct 20 13:49:42 2022 +0200 @@ -0,0 +1,43 @@ +// +// UserProfileComponent.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 20/10/22. +// + +import SwiftUI + +struct UserProfile: View { + @ObservedObject var user: User + @ObservedObject var storeKitRC: StoreKitRC + + var body: some View { + HStack(spacing: 20) { + UserImage(uiImage: user.data.uiImage) + + VStack(alignment: .leading, spacing: 8) { + Text(user.data.username) + .font(.title) + .fontWeight(.semibold) + + if storeKitRC.isActive { + Text("Premium user ⭐️") + .foregroundColor(.secondary) + } + } + + Spacer() + } + .padding() + .background( + RoundedRectangle(cornerRadius: 20) + .foregroundColor(.white) + ) + } +} + +struct UserProfile_Previews: PreviewProvider { + static var previews: some View { + UserProfile(user: User(), storeKitRC: StoreKitRC()) + } +}