adding in sheet but not working yet for user menu to have log out option

This commit is contained in:
talksik
2021-12-14 17:49:15 -08:00
parent c3aa79fef1
commit 798fbc9e06
3 changed files with 44 additions and 1 deletions
@@ -0,0 +1,27 @@
//
// UserMenu.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/14/21.
//
import SwiftUI
struct UserMenuView: View {
@Environment(\.dismiss) var dismiss
var body: some View {
Button("Press to dismiss") {
dismiss()
}
.font(.title)
.padding()
.background(Color.black)
}
}
struct UserMenuView_Previews: PreviewProvider {
static var previews: some View {
UserMenuView()
}
}
+5 -1
View File
@@ -10,6 +10,7 @@ import SwiftUI
struct HeaderView: View {
@EnvironmentObject var authStore:AuthSessionStore
@State var averageColor: UIColor = UIColor(NirvanaColor.teal)
@State var showingMenu: Bool = false
var body: some View {
HStack(alignment:.center) {
@@ -27,7 +28,9 @@ struct HeaderView: View {
.frame(width: 40, height: 40)
.clipShape(Circle())
.padding(5)
.shadow(radius:5)
.sheet(isPresented: $showingMenu) {
UserMenuView()
}
}
}
.frame(maxWidth: .infinity)
@@ -35,6 +38,7 @@ struct HeaderView: View {
.background(NirvanaColor.solidBlue)
.cornerRadius(100)
.padding(.horizontal)
.shadow(radius: 10)
.onAppear{
// set background color based on profile picture tint
if authStore.sessionState == SessionState.isAuthenticated {