-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
150 additions
and
57 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 was deleted.
Oops, something went wrong.
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,72 @@ | ||
// | ||
// StarterIntro.swift | ||
// Forumate | ||
// | ||
// Created by Kyle on 2023/5/21. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct StarterIntro: View { | ||
@Environment(\.dismiss) private var dismiss | ||
@Environment(\.supportsMultipleWindows) private var supportsMultipleWindows | ||
@Environment(\.verticalSizeClass) private var verticalSizeClass | ||
|
||
var body: some View { | ||
VStack { | ||
ScrollView { | ||
VStack { | ||
Text("Welcome to Forumate") | ||
.font(.system(.title, design: .serif, weight: .bold)) | ||
.padding() | ||
.background(.tint.opacity(0.3), in: RoundedRectangle(cornerRadius: 20)) | ||
#if os(iOS) | ||
.padding(.top, verticalSizeClass == .regular ? 100 : 0) | ||
#endif | ||
Text("Highlighted Features") | ||
.font(.system(.title, design: .serif, weight: .bold)) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.padding() | ||
StarterIntroCardView(card: StarterIntroCard(image: "lasso.and.sparkles", text: "Native Client with Multiple OS Support", style: .pink.opacity(0.3))) | ||
if supportsMultipleWindows { | ||
StarterIntroCardView(card: StarterIntroCard(image: "macwindow.badge.plus", text: "Multiple Window Support", style: .blue.opacity(0.3))) | ||
} | ||
} | ||
} | ||
.frame(maxWidth: .infinity) | ||
|
||
Button { | ||
dismiss() | ||
} label: { | ||
Text("Continue") | ||
.font(.system(.body, design: .rounded, weight: .bold)) | ||
#if !os(watchOS) | ||
.padding(.vertical, 5) | ||
#endif | ||
.frame(maxWidth: .infinity) | ||
} | ||
.buttonStyle(.borderedProminent) | ||
#if !os(watchOS) | ||
.padding(.horizontal, 50) | ||
.padding(.vertical) | ||
#endif | ||
} | ||
} | ||
} | ||
|
||
struct StarterIntro_Previews: PreviewProvider, View { | ||
@State private var present = true | ||
|
||
var body: some View { | ||
Button("Show Starter Intro") { | ||
present.toggle() | ||
} | ||
.sheet(isPresented: $present) { | ||
StarterIntro() | ||
} | ||
} | ||
|
||
static var previews: some View { | ||
StarterIntro_Previews() | ||
} | ||
} |
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,15 @@ | ||
// | ||
// StarterIntroCard.swift | ||
// Forumate | ||
// | ||
// Created by Kyle on 2023/6/7. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct StarterIntroCard<S: ShapeStyle> { | ||
let image: String | ||
let text: String | ||
let style: S | ||
} |
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 @@ | ||
// | ||
// StarterIntroCardView.swift | ||
// Forumate | ||
// | ||
// Created by Kyle on 2023/6/7. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct StarterIntroCardView<S: ShapeStyle>: View { | ||
let card: StarterIntroCard<S> | ||
|
||
var body: some View { | ||
HStack { | ||
Image(systemName: card.image) | ||
.symbolRenderingMode(.hierarchical) | ||
.font(.largeTitle) | ||
|
||
.padding(.horizontal) | ||
Text(card.text) | ||
Spacer() | ||
|
||
} | ||
.padding(.vertical) | ||
.frame(maxWidth: .infinity) | ||
.background(card.style, in: RoundedRectangle(cornerRadius: 20)) | ||
.padding(.horizontal) | ||
} | ||
} | ||
|
||
struct StarterIntroCardView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
VStack { | ||
StarterIntroCardView(card: StarterIntroCard(image: "macwindow.badge.plus", text: "Multiple Window support", style: .blue.opacity(0.3))) | ||
StarterIntroCardView(card: StarterIntroCard(image: "macwindow.badge.plus", text: "Multiple Window support", style: .yellow.opacity(0.3))) | ||
} | ||
} | ||
} |