refactor phase 1 for onboarding flow
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@
|
||||
<key>nirvana-ios.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@@ -11,25 +11,24 @@ struct OnboardingTemplateView: View {
|
||||
let screenWidth = UIScreen.main.bounds.width
|
||||
let screenHeight = UIScreen.main.bounds.height
|
||||
|
||||
private let headerText: String
|
||||
private let imageName:String
|
||||
private let headerText: String?
|
||||
private let imageName:String?
|
||||
|
||||
private let mainLeadingActionText:String
|
||||
private let mainHighlightedActionText:String
|
||||
private let mainTrailingActionText:String
|
||||
private let mainLeadingActionText:String?
|
||||
private let mainHighlightedActionText:String?
|
||||
private let mainTrailingActionText:String?
|
||||
|
||||
private let subActionText:String
|
||||
private let subActionText:String?
|
||||
|
||||
private var bottomActionArea:AnyView
|
||||
private var bottomActionArea:AnyView?
|
||||
|
||||
|
||||
init(hdrText:String = "Welcome to Nirvana",
|
||||
imgName:String = "undraw_calling_re_mgft",
|
||||
mainLeadingActText:String = "Your ",
|
||||
mainHighlightedActText: String = "minimalist ",
|
||||
mainTrailingActText:String = "social media.",
|
||||
subActText: String = "this is the test of the main thing.",
|
||||
bottomActArea:AnyView = AnyView(Text("this is the action area"))) {
|
||||
init(hdrText:String? = nil,
|
||||
imgName:String? = nil,
|
||||
mainLeadingActText:String? = nil,
|
||||
mainHighlightedActText: String? = nil,
|
||||
mainTrailingActText:String? = nil,
|
||||
subActText: String? = nil,
|
||||
bottomActArea:AnyView? = nil) {
|
||||
self.headerText = hdrText
|
||||
self.imageName = imgName
|
||||
self.mainLeadingActionText = mainLeadingActText
|
||||
@@ -40,64 +39,20 @@ struct OnboardingTemplateView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
// nav bar
|
||||
HeaderView()
|
||||
|
||||
VStack {
|
||||
// illustration
|
||||
Image("undraw_friendship_mni7")
|
||||
.renderingMode(.original)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
// imported image name
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
if (self.mainLeadingActionText != nil) { //only show section if leading text there assuming everything is won't be there
|
||||
|
||||
Text("Your ")
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.black)
|
||||
+ Text("minimalist ")
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
+ Text("social media.")
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.black)
|
||||
|
||||
Text("tired of the rat race on insta, tik-tok, snap, meta?")
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.top, 5)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: screenWidth - 20)
|
||||
|
||||
|
||||
VStack(alignment: .center) {
|
||||
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(
|
||||
action: {
|
||||
print("link to website learn more clicked")
|
||||
},
|
||||
label: {
|
||||
Text("Learn More")
|
||||
.bold()
|
||||
})
|
||||
|
||||
//learn more button to usenirvana.com
|
||||
}
|
||||
.padding(.top, 20)
|
||||
// passed in action area from template user
|
||||
self.bottomActionArea
|
||||
|
||||
}
|
||||
.padding()
|
||||
@@ -110,8 +65,6 @@ struct OnboardingTemplateView: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
// .background(RadialGradient(gradient: Gradient(colors: [NirvanaColor.teal.opacity(0.1), NirvanaColor.bgLightGrey, NirvanaColor.bgLightGrey]), center: .center, startRadius: 0, endRadius: 200)
|
||||
// )
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,24 @@ struct WelcomeView: View {
|
||||
let screenHeight = UIScreen.main.bounds.height
|
||||
|
||||
var body: some View {
|
||||
OnboardingTemplateView()
|
||||
VStack(spacing: 0) {
|
||||
HeaderView()
|
||||
|
||||
VStack {
|
||||
OnboardingImageView("undraw_friendship_mni7")
|
||||
|
||||
OnboardingActionTextView(leadingText: "Your ", highlightedText: "minimalist ", trailingText: "social media", subActText: "tired of the rat race on insta, snap, tik-tok, \"meta\"?")
|
||||
|
||||
OnboardingActionAreaView()
|
||||
}
|
||||
.padding()
|
||||
.frame(maxWidth: screenWidth - 20)
|
||||
|
||||
Spacer()
|
||||
} //outermost vstack
|
||||
.accentColor(NirvanaColor.teal)
|
||||
.background(NirvanaColor.bgLightGrey)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} // View body
|
||||
} // View
|
||||
|
||||
@@ -23,3 +40,90 @@ struct WelcomeView_Previews: PreviewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct OnboardingActionTextView: View {
|
||||
let screenWidth = UIScreen.main.bounds.width
|
||||
let screenHeight = UIScreen.main.bounds.height
|
||||
|
||||
private var mainLeadingActionText:String
|
||||
private var mainHighlightedActionText:String
|
||||
private var mainTrailingActionText:String
|
||||
|
||||
private var subActionText:String
|
||||
|
||||
init(leadingText:String, highlightedText: String, trailingText: String, subActText: String) {
|
||||
self.mainLeadingActionText = leadingText
|
||||
self.mainHighlightedActionText = highlightedText
|
||||
self.mainTrailingActionText = trailingText
|
||||
|
||||
self.subActionText = subActText
|
||||
}
|
||||
|
||||
var body : some View {
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
Text(self.mainLeadingActionText)
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.black)
|
||||
+ Text(self.mainHighlightedActionText)
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.teal)
|
||||
+ Text(self.mainTrailingActionText)
|
||||
.font(.title)
|
||||
.foregroundColor(NirvanaColor.black)
|
||||
|
||||
Text(self.subActionText)
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.top, 5)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: screenWidth - 20)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingActionAreaView: View {
|
||||
var body : some View {
|
||||
VStack(alignment: .center) {
|
||||
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(
|
||||
action: {
|
||||
print("link to website learn more clicked")
|
||||
},
|
||||
label: {
|
||||
Text("Learn More")
|
||||
.bold()
|
||||
})
|
||||
|
||||
//learn more button to usenirvana.com
|
||||
}
|
||||
.padding(.top, 20)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingImageView: View {
|
||||
private var imageName:String
|
||||
|
||||
init(_ imgName: String) {
|
||||
self.imageName = imgName
|
||||
}
|
||||
|
||||
var body : some View {
|
||||
Image(self.imageName)
|
||||
.renderingMode(.original)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user