-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from dankimio/onboarding
Onboarding
- Loading branch information
Showing
6 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import SwiftUI | |
struct FlipTimerApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
TimerView() | ||
ContentView() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
@AppStorage("onboardingDismissed") private var onboardingDismissed = false | ||
|
||
var body: some View { | ||
if onboardingDismissed { | ||
TimerView() | ||
} else { | ||
OnboardingView() | ||
} | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import SwiftUI | ||
|
||
struct FeatureCell: View { | ||
var imageName: String | ||
var title: String | ||
var subtitle: String | ||
|
||
var body: some View { | ||
HStack(alignment: .top, spacing: 24) { | ||
Image(systemName: imageName) | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(width: 32) | ||
.foregroundColor(.blue) | ||
|
||
VStack(alignment: .leading, spacing: 4, content: { | ||
Text(title) | ||
.font(.subheadline) | ||
.fontWeight(.semibold) | ||
Text(subtitle) | ||
.foregroundColor(.secondary) | ||
.font(.subheadline) | ||
}) | ||
|
||
Spacer() | ||
} | ||
} | ||
} | ||
|
||
struct FeatureCell_Previews: PreviewProvider { | ||
static var previews: some View { | ||
FeatureCell( | ||
imageName: "text.badge.checkmark", | ||
title: "Some Feature", | ||
subtitle: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import SwiftUI | ||
|
||
struct OnboardingView: View { | ||
@AppStorage("onboardingDismissed") private var onboardingDismissed = false | ||
|
||
var body: some View { | ||
VStack { | ||
Spacer() | ||
|
||
Text("Welcome to\nFlip Timer!") | ||
.font(.largeTitle) | ||
.fontWeight(.bold) | ||
.multilineTextAlignment(.center) | ||
.padding() | ||
|
||
Spacer() | ||
|
||
VStack(spacing: 24) { | ||
FeatureCell( | ||
imageName: "hourglass", | ||
title: "Timer Interval", | ||
subtitle: "Tap on the timer label and choose your timer length." | ||
) | ||
FeatureCell( | ||
imageName: "arrow.turn.right.down", | ||
title: "No Screen Time", | ||
subtitle: "Put your device on the table screen facing down to start the timer." | ||
) | ||
FeatureCell( | ||
imageName: "speaker.wave.2.fill", | ||
title: "Take a Break", | ||
subtitle: "You will hear a sound when the timer is finished. Take a break and restart when you're ready!" | ||
) | ||
} | ||
.padding() | ||
|
||
// TODO: find out if spacers can have weight | ||
Spacer() | ||
Spacer() | ||
|
||
Button( | ||
action: { | ||
onboardingDismissed = true | ||
}, | ||
label: { | ||
HStack { | ||
Spacer() | ||
Text("Continue") | ||
.font(.headline) | ||
.foregroundColor(.white) | ||
Spacer() | ||
} | ||
.padding() | ||
.background(Color.blue) | ||
.cornerRadius(12) | ||
}) | ||
} | ||
.padding() | ||
} | ||
} | ||
|
||
struct OnboardingView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
OnboardingView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters