refactor phase 1 for onboarding flow
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
<key>nirvana-ios.xcscheme_^#shared#^_</key>
|
<key>nirvana-ios.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -11,25 +11,24 @@ struct OnboardingTemplateView: View {
|
|||||||
let screenWidth = UIScreen.main.bounds.width
|
let screenWidth = UIScreen.main.bounds.width
|
||||||
let screenHeight = UIScreen.main.bounds.height
|
let screenHeight = UIScreen.main.bounds.height
|
||||||
|
|
||||||
private let headerText: String
|
private let headerText: String?
|
||||||
private let imageName:String
|
private let imageName:String?
|
||||||
|
|
||||||
private let mainLeadingActionText:String
|
private let mainLeadingActionText:String?
|
||||||
private let mainHighlightedActionText:String
|
private let mainHighlightedActionText:String?
|
||||||
private let mainTrailingActionText:String
|
private let mainTrailingActionText:String?
|
||||||
|
|
||||||
private let subActionText:String
|
private let subActionText:String?
|
||||||
|
|
||||||
private var bottomActionArea:AnyView
|
private var bottomActionArea:AnyView?
|
||||||
|
|
||||||
|
init(hdrText:String? = nil,
|
||||||
init(hdrText:String = "Welcome to Nirvana",
|
imgName:String? = nil,
|
||||||
imgName:String = "undraw_calling_re_mgft",
|
mainLeadingActText:String? = nil,
|
||||||
mainLeadingActText:String = "Your ",
|
mainHighlightedActText: String? = nil,
|
||||||
mainHighlightedActText: String = "minimalist ",
|
mainTrailingActText:String? = nil,
|
||||||
mainTrailingActText:String = "social media.",
|
subActText: String? = nil,
|
||||||
subActText: String = "this is the test of the main thing.",
|
bottomActArea:AnyView? = nil) {
|
||||||
bottomActArea:AnyView = AnyView(Text("this is the action area"))) {
|
|
||||||
self.headerText = hdrText
|
self.headerText = hdrText
|
||||||
self.imageName = imgName
|
self.imageName = imgName
|
||||||
self.mainLeadingActionText = mainLeadingActText
|
self.mainLeadingActionText = mainLeadingActText
|
||||||
@@ -40,64 +39,20 @@ struct OnboardingTemplateView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
// nav bar
|
// nav bar
|
||||||
HeaderView()
|
HeaderView()
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
// illustration
|
// imported image name
|
||||||
Image("undraw_friendship_mni7")
|
|
||||||
.renderingMode(.original)
|
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
// passed in action area from template user
|
||||||
VStack(alignment: .center) {
|
self.bottomActionArea
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
@@ -110,8 +65,6 @@ struct OnboardingTemplateView: View {
|
|||||||
.navigationBarTitleDisplayMode(.inline)
|
.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)
|
||||||
// )
|
// )
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,24 @@ struct WelcomeView: View {
|
|||||||
let screenHeight = UIScreen.main.bounds.height
|
let screenHeight = UIScreen.main.bounds.height
|
||||||
|
|
||||||
var body: some View {
|
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 body
|
||||||
} // View
|
} // 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