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
// 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
}
}
+5
View File
@@ -10,3 +10,8 @@ import Foundation
final class NirvanaConstants {
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 {
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)
+19 -26
View File
@@ -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 {