From b5faa82a16162f0e2e68f7d08ab918f6e8b079d9 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 12 Dec 2021 18:47:34 -0800 Subject: [PATCH] getting basic navigation and fixing more sizing and position and spacing issues --- nirvana-ios/ContentView.swift | 24 +++++++++- nirvana-ios/Globals/constants.swift | 5 +++ nirvana-ios/Views/HomeView/HomeView.swift | 3 +- .../Views/WelcomeView/WelcomeView.swift | 45 ++++++++----------- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/nirvana-ios/ContentView.swift b/nirvana-ios/ContentView.swift index 4834ff9..d0aa062 100644 --- a/nirvana-ios/ContentView.swift +++ b/nirvana-ios/ContentView.swift @@ -7,9 +7,31 @@ import SwiftUI +// dummy parent navigation page to test out all pages for now struct ContentView: View { +// @State private var selectedView: NavigationViews? = NavigationViews.welcomeView + var body: some View { - WelcomeView() + NavigationView { + VStack { + NavigationLink(destination: WelcomeView()) { + Text("Welcome Page") + } + + NavigationLink(destination: HomeView()) { + Text("Home Page") + } + + NavigationLink(destination: WelcomeView()) { + Text("Onboarding - 1") + } + } + .navigationBarTitle("View All Pages", displayMode: .inline) + + } + +// .navigationViewStyle(StackNavigationViewStyle()) +// .environmentObject()//can pass anything to send to all views within navigation view } } diff --git a/nirvana-ios/Globals/constants.swift b/nirvana-ios/Globals/constants.swift index 312741e..22c5d16 100644 --- a/nirvana-ios/Globals/constants.swift +++ b/nirvana-ios/Globals/constants.swift @@ -10,3 +10,8 @@ import Foundation final class NirvanaConstants { static let landingPageUrl: String = "https://usenirvana.com" } + +enum NavigationViews { + case welcomeView + case homeView +} diff --git a/nirvana-ios/Views/HomeView/HomeView.swift b/nirvana-ios/Views/HomeView/HomeView.swift index 6d20b10..7740183 100644 --- a/nirvana-ios/Views/HomeView/HomeView.swift +++ b/nirvana-ios/Views/HomeView/HomeView.swift @@ -9,13 +9,14 @@ import SwiftUI struct HomeView: View { var body: some View { - VStack { + VStack(alignment: .leading, spacing: 0) { HeaderView(isAuth:true) ChatsCarouselView() FooterControlsView() } + .navigationBarHidden(true) .frame(maxWidth:.infinity, maxHeight: .infinity) .accentColor(NirvanaColor.teal) .background(NirvanaColor.bgLightGrey) diff --git a/nirvana-ios/Views/WelcomeView/WelcomeView.swift b/nirvana-ios/Views/WelcomeView/WelcomeView.swift index 76774e7..97ab7be 100644 --- a/nirvana-ios/Views/WelcomeView/WelcomeView.swift +++ b/nirvana-ios/Views/WelcomeView/WelcomeView.swift @@ -12,7 +12,7 @@ struct WelcomeView: View { let screenHeight = UIScreen.main.bounds.height var body: some View { - VStack { + VStack(spacing: 0) { // nav bar HeaderView() @@ -23,8 +23,6 @@ struct WelcomeView: View { .resizable() .aspectRatio(contentMode: .fit) - Spacer() - VStack(alignment: .leading) { Text("Your ") @@ -41,26 +39,23 @@ struct WelcomeView: View { .foregroundColor(Color.gray) .padding(.top, 5) .fixedSize(horizontal: false, vertical: true) + + Spacer() } .frame(maxWidth: screenWidth - 20) - Spacer() VStack(alignment: .center) { - Button( - action: { - print("Start your detox button clicked") - }, - label: { - Text("Start Your Detox") - .bold() - .foregroundColor(NirvanaColor.white) - .frame(maxWidth: .infinity) - .padding(.vertical, 25) - .background(NirvanaColor.teal) - .clipShape(Capsule()) - .shadow(radius:10) - }) + NavigationLink(destination: HomeView()) { + Text("Start Your Detox") + .bold() + .foregroundColor(NirvanaColor.white) + .frame(maxWidth: .infinity) + .padding(.vertical, 20) + .background(NirvanaColor.teal) + .clipShape(Capsule()) + .shadow(radius:10) + } Button( @@ -71,27 +66,25 @@ struct WelcomeView: View { Text("Learn More") .bold() }) - .background(NirvanaColor.bgLightGrey) //learn more button to usenirvana.com } .padding(.top, 20) - .frame(maxWidth: 300) - Spacer() } .padding() .frame(maxWidth: screenWidth - 20) - } - .frame(maxWidth: .infinity, maxHeight: .infinity) + Spacer() + } // Vstack .accentColor(NirvanaColor.teal) .background(NirvanaColor.bgLightGrey) + .navigationBarTitleDisplayMode(.inline) // .background(RadialGradient(gradient: Gradient(colors: [NirvanaColor.teal.opacity(0.1), NirvanaColor.bgLightGrey, NirvanaColor.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200) // ) - - } -} + + } // View body +} // View struct WelcomeView_Previews: PreviewProvider {