Skip to content

Commit

Permalink
Add StarterIntroCard
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Jun 6, 2023
1 parent 8ce580c commit 1bd5ce8
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 57 deletions.
26 changes: 25 additions & 1 deletion Forumate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
272193A12A19CCFA00C221BC /* JSONRawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272193A02A19CCFA00C221BC /* JSONRawRepresentable.swift */; };
2726053F2A1A005C0018B908 /* ForumateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2726053E2A1A005C0018B908 /* ForumateTests.swift */; };
272605802A1A12450018B908 /* Category+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2726057F2A1A12450018B908 /* Category+Preview.swift */; };
2733B4D02A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4CF2A2F918A00BCF528 /* StarterIntroCardView.swift */; };
2733B4D12A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4CF2A2F918A00BCF528 /* StarterIntroCardView.swift */; };
2733B4D22A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4CF2A2F918A00BCF528 /* StarterIntroCardView.swift */; };
2733B4D42A2F929300BCF528 /* StarterIntroCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4D32A2F929300BCF528 /* StarterIntroCard.swift */; };
2733B4D52A2F929300BCF528 /* StarterIntroCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4D32A2F929300BCF528 /* StarterIntroCard.swift */; };
2733B4D62A2F929300BCF528 /* StarterIntroCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2733B4D32A2F929300BCF528 /* StarterIntroCard.swift */; };
2735D6062A2F850B000D5966 /* SupportSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2735D6052A2F850B000D5966 /* SupportSection.swift */; };
2735D6082A2F852D000D5966 /* PrivacyPolicySection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2735D6072A2F852D000D5966 /* PrivacyPolicySection.swift */; };
2735D6092A2F8556000D5966 /* SupportSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2735D6052A2F850B000D5966 /* SupportSection.swift */; };
Expand Down Expand Up @@ -212,6 +218,8 @@
2726053C2A1A005C0018B908 /* ForumateTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ForumateTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2726053E2A1A005C0018B908 /* ForumateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForumateTests.swift; sourceTree = "<group>"; };
2726057F2A1A12450018B908 /* Category+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Category+Preview.swift"; sourceTree = "<group>"; };
2733B4CF2A2F918A00BCF528 /* StarterIntroCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarterIntroCardView.swift; sourceTree = "<group>"; };
2733B4D32A2F929300BCF528 /* StarterIntroCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StarterIntroCard.swift; sourceTree = "<group>"; };
2735D6052A2F850B000D5966 /* SupportSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportSection.swift; sourceTree = "<group>"; };
2735D6072A2F852D000D5966 /* PrivacyPolicySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyPolicySection.swift; sourceTree = "<group>"; };
273AFBCA2A1A642900DD08F5 /* CategoryListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryListView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -336,6 +344,16 @@
path = PreviewData;
sourceTree = "<group>";
};
2733B4CE2A2F916F00BCF528 /* StarterIntro */ = {
isa = PBXGroup;
children = (
270097D02A19D7E300CA01B5 /* StarterIntro.swift */,
2733B4CF2A2F918A00BCF528 /* StarterIntroCardView.swift */,
2733B4D32A2F929300BCF528 /* StarterIntroCard.swift */,
);
path = StarterIntro;
sourceTree = "<group>";
};
273AFBD42A1A800C00DD08F5 /* Sections */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -457,7 +475,7 @@
isa = PBXGroup;
children = (
278E53EA2A18E83000DCD159 /* PlaceholderView.swift */,
270097D02A19D7E300CA01B5 /* StarterIntro.swift */,
2733B4CE2A2F916F00BCF528 /* StarterIntro */,
278E53EB2A18E83000DCD159 /* Tab */,
);
path = View;
Expand Down Expand Up @@ -822,7 +840,9 @@
files = (
273AFC042A1A960600DD08F5 /* Category+Preview.swift in Sources */,
273AFC082A1A962200DD08F5 /* JSONRawRepresentable.swift in Sources */,
2733B4D12A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */,
273AFC142A1A967D00DD08F5 /* LatestTopicsView.swift in Sources */,
2733B4D52A2F929300BCF528 /* StarterIntroCard.swift in Sources */,
273AFC0D2A1A964200DD08F5 /* SettingsTabRoot.swift in Sources */,
273AFC242A1A97CC00DD08F5 /* InboxTab.swift in Sources */,
273AFC072A1A961F00DD08F5 /* HexToColor.swift in Sources */,
Expand Down Expand Up @@ -877,7 +897,9 @@
files = (
27CDD3C02A1BB758003E3D00 /* TopicLabel.swift in Sources */,
27CDD3BC2A1BB755003E3D00 /* CategoryDetail.swift in Sources */,
2733B4D22A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */,
27CDD3A12A1BB608003E3D00 /* StarterIntro.swift in Sources */,
2733B4D62A2F929300BCF528 /* StarterIntroCard.swift in Sources */,
27CDD3A22A1BB622003E3D00 /* InboxTab.swift in Sources */,
27CDD3B62A1BB728003E3D00 /* CommunitySectionHeader.swift in Sources */,
27CDD3A72A1BB628003E3D00 /* GeneralSection.swift in Sources */,
Expand Down Expand Up @@ -932,7 +954,9 @@
files = (
273AFBD92A1A86A000DD08F5 /* TopicLabel.swift in Sources */,
272605802A1A12450018B908 /* Category+Preview.swift in Sources */,
2733B4D02A2F918A00BCF528 /* StarterIntroCardView.swift in Sources */,
270097CC2A19D66E00CA01B5 /* SettingsTabRoot.swift in Sources */,
2733B4D42A2F929300BCF528 /* StarterIntroCard.swift in Sources */,
27DFFCDF2A2AF64A005661BD /* ColorToImageText.swift in Sources */,
277546E12A19EF0F000FDAA0 /* String+HTMLLink.swift in Sources */,
278E540E2A18E83000DCD159 /* CommunityLabel.swift in Sources */,
Expand Down
56 changes: 0 additions & 56 deletions Forumate/View/StarterIntro.swift

This file was deleted.

72 changes: 72 additions & 0 deletions Forumate/View/StarterIntro/StarterIntro.swift
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()
}
}
15 changes: 15 additions & 0 deletions Forumate/View/StarterIntro/StarterIntroCard.swift
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
}
38 changes: 38 additions & 0 deletions Forumate/View/StarterIntro/StarterIntroCardView.swift
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)))
}
}
}

0 comments on commit 1bd5ce8

Please sign in to comment.