getting basic navigation and fixing more sizing and position and spacing issues

This commit is contained in:
talksik
2021-12-12 18:47:34 -08:00
parent 13297d91d0
commit b5faa82a16
4 changed files with 49 additions and 28 deletions
+23 -1
View File
@@ -7,9 +7,31 @@
import SwiftUI import SwiftUI
// dummy parent navigation page to test out all pages for now
struct ContentView: View { struct ContentView: View {
// @State private var selectedView: NavigationViews? = NavigationViews.welcomeView
var body: some View { 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
} }
} }
+5
View File
@@ -10,3 +10,8 @@ import Foundation
final class NirvanaConstants { final class NirvanaConstants {
static let landingPageUrl: String = "https://usenirvana.com" static let landingPageUrl: String = "https://usenirvana.com"
} }
enum NavigationViews {
case welcomeView
case homeView
}
+2 -1
View File
@@ -9,13 +9,14 @@ import SwiftUI
struct HomeView: View { struct HomeView: View {
var body: some View { var body: some View {
VStack { VStack(alignment: .leading, spacing: 0) {
HeaderView(isAuth:true) HeaderView(isAuth:true)
ChatsCarouselView() ChatsCarouselView()
FooterControlsView() FooterControlsView()
} }
.navigationBarHidden(true)
.frame(maxWidth:.infinity, maxHeight: .infinity) .frame(maxWidth:.infinity, maxHeight: .infinity)
.accentColor(NirvanaColor.teal) .accentColor(NirvanaColor.teal)
.background(NirvanaColor.bgLightGrey) .background(NirvanaColor.bgLightGrey)
+18 -25
View File
@@ -12,7 +12,7 @@ struct WelcomeView: View {
let screenHeight = UIScreen.main.bounds.height let screenHeight = UIScreen.main.bounds.height
var body: some View { var body: some View {
VStack { VStack(spacing: 0) {
// nav bar // nav bar
HeaderView() HeaderView()
@@ -23,8 +23,6 @@ struct WelcomeView: View {
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
Spacer()
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("Your ") Text("Your ")
@@ -41,26 +39,23 @@ struct WelcomeView: View {
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
.padding(.top, 5) .padding(.top, 5)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
Spacer()
} }
.frame(maxWidth: screenWidth - 20) .frame(maxWidth: screenWidth - 20)
Spacer()
VStack(alignment: .center) { VStack(alignment: .center) {
Button( NavigationLink(destination: HomeView()) {
action: { Text("Start Your Detox")
print("Start your detox button clicked") .bold()
}, .foregroundColor(NirvanaColor.white)
label: { .frame(maxWidth: .infinity)
Text("Start Your Detox") .padding(.vertical, 20)
.bold() .background(NirvanaColor.teal)
.foregroundColor(NirvanaColor.white) .clipShape(Capsule())
.frame(maxWidth: .infinity) .shadow(radius:10)
.padding(.vertical, 25) }
.background(NirvanaColor.teal)
.clipShape(Capsule())
.shadow(radius:10)
})
Button( Button(
@@ -71,27 +66,25 @@ struct WelcomeView: View {
Text("Learn More") Text("Learn More")
.bold() .bold()
}) })
.background(NirvanaColor.bgLightGrey)
//learn more button to usenirvana.com //learn more button to usenirvana.com
} }
.padding(.top, 20) .padding(.top, 20)
.frame(maxWidth: 300)
Spacer()
} }
.padding() .padding()
.frame(maxWidth: screenWidth - 20) .frame(maxWidth: screenWidth - 20)
} Spacer()
.frame(maxWidth: .infinity, maxHeight: .infinity) } // Vstack
.accentColor(NirvanaColor.teal) .accentColor(NirvanaColor.teal)
.background(NirvanaColor.bgLightGrey) .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) // .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 { struct WelcomeView_Previews: PreviewProvider {