Skip to content

Commit

Permalink
feat(stuff): add some spacing & font weight
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorjmoriya committed May 25, 2022
1 parent 3ef948e commit 6cdec75
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 31 deletions.
4 changes: 4 additions & 0 deletions SwiftUIQuizz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
5F0B738C283BACCE008EE6DC /* DesignSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0B738B283BACCE008EE6DC /* DesignSystem.swift */; };
5F0B738E283BAD6E008EE6DC /* DesignSystem.Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0B738D283BAD6E008EE6DC /* DesignSystem.Color.swift */; };
5F0B7390283BC476008EE6DC /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0B738F283BC476008EE6DC /* Data.swift */; };
5F0B7392283E6AA0008EE6DC /* DesignSystem.Padding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0B7391283E6AA0008EE6DC /* DesignSystem.Padding.swift */; };
5F3A266A282BDF2C00E857CC /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3A2669282BDF2C00E857CC /* ProfileView.swift */; };
5F3AC735282408030041CBBC /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3AC734282408030041CBBC /* Manager.swift */; };
5F3AC737282408250041CBBC /* Manager.API.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3AC736282408250041CBBC /* Manager.API.swift */; };
Expand Down Expand Up @@ -52,6 +53,7 @@
5F0B738B283BACCE008EE6DC /* DesignSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignSystem.swift; sourceTree = "<group>"; };
5F0B738D283BAD6E008EE6DC /* DesignSystem.Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignSystem.Color.swift; sourceTree = "<group>"; };
5F0B738F283BC476008EE6DC /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
5F0B7391283E6AA0008EE6DC /* DesignSystem.Padding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesignSystem.Padding.swift; sourceTree = "<group>"; };
5F3A2669282BDF2C00E857CC /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
5F3AC734282408030041CBBC /* Manager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = "<group>"; };
5F3AC736282408250041CBBC /* Manager.API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Manager.API.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,6 +123,7 @@
children = (
5F0B738B283BACCE008EE6DC /* DesignSystem.swift */,
5F0B738D283BAD6E008EE6DC /* DesignSystem.Color.swift */,
5F0B7391283E6AA0008EE6DC /* DesignSystem.Padding.swift */,
);
path = DesignSystem;
sourceTree = "<group>";
Expand Down Expand Up @@ -323,6 +326,7 @@
5FE913482822A76E00C0CDE0 /* SwiftUIQuizzApp.swift in Sources */,
5FE913592822B96F00C0CDE0 /* Views.swift in Sources */,
5FDC437428294C6600A4F011 /* InitialView.swift in Sources */,
5F0B7392283E6AA0008EE6DC /* DesignSystem.Padding.swift in Sources */,
5FFA8587282A886A008F47A5 /* String.swift in Sources */,
5F3AC735282408030041CBBC /* Manager.swift in Sources */,
1830AF88283E4A5800D4EA1A /* Manager.SFX.swift in Sources */,
Expand Down
16 changes: 16 additions & 0 deletions SwiftUIQuizz/DesignSystem/DesignSystem.Padding.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// DesignSystem.Padding.swift
// SwiftUIQuizz
//
// Created by Vitor Jundi Moriya on 25/05/22.
//

import SwiftUI

extension DesignSystem {
struct Padding {
static let microPadding: CGFloat = 10
static let padding: CGFloat = 10
static let macroPadding: CGFloat = 10
}
}
1 change: 1 addition & 0 deletions SwiftUIQuizz/Views/Buttons/MultipleChoiceButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extension Views {
.overlay(RoundedRectangle(cornerRadius: Constants.rectangleCornerRadius)
.stroke(Color.black, lineWidth: Constants.strokeLineWidth)
)
.padding(.bottom, DesignSystem.Padding.padding)
.disabled(isAnimating)
}
}
Expand Down
3 changes: 3 additions & 0 deletions SwiftUIQuizz/Views/ConclusionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ extension Views {
struct ConclusionView: View {
var body: some View {
Text("Finished Quiz")
Text("Correct Answers: \(Manager.AnswerTracker.shared.correctAnswers)")
Text("Incorrect Answers: \(Manager.AnswerTracker.shared.wrongAnswers)")
Text("Total Questions Answers: \(Manager.AnswerTracker.shared.questionAmount)")
NavigationLink(destination: InitialView(viewModel: .init()).navigationBarHidden(true)) {
Text("Play Again")
}
Expand Down
5 changes: 3 additions & 2 deletions SwiftUIQuizz/Views/InitialView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ extension Views {
Text("I wanna play a game")
}
}
}.navigationViewStyle(StackNavigationViewStyle())
.navigationBarHidden(true)
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarHidden(true)
}
}
}
Expand Down
55 changes: 26 additions & 29 deletions SwiftUIQuizz/Views/QuestionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ extension Views {
DesignSystem.Color.byCategory(category: viewModel.category).uiColor.edgesIgnoringSafeArea(.all)
if viewModel.answers.count == 0 {
renderBody(answerType: .multiple, isAnimating: $isAnimating)
.padding()
.padding(.horizontal, DesignSystem.Padding.macroPadding)
.redacted(reason: .placeholder)
} else {
renderBody(
answerType: viewModel.answerType,
isAnimating: $isAnimating
)
.padding()
.padding(.horizontal, DesignSystem.Padding.macroPadding)
}
}
}
Expand All @@ -39,11 +39,14 @@ extension Views {
answerType: Manager.API.AnswerTypes,
isAnimating: Binding<Bool>
) -> some View {
VStack(spacing: Constants.microPadding) {
VStack(spacing: DesignSystem.Padding.microPadding) {
viewModel.image
Text(viewModel.title)
.padding(.bottom, Constants.macroPadding)
.bold()
.padding(.bottom, DesignSystem.Padding.macroPadding)
Text(viewModel.question)
.bold()
.padding(.bottom, DesignSystem.Padding.macroPadding)
switch answerType {
case .multiple:
ForEach(0 ..< 4) { index in
Expand All @@ -57,24 +60,23 @@ extension Views {
)
}
case .boolean:
HStack {
BooleanButton(isAnimating: $isAnimating,
isCorrect: viewModel.checkBooleanQuestion(
answer: "True",
questionNumber: currentQuestion
),
buttonText: viewModel.answers.count == 0 ? "" : "True"
)
Spacer()

BooleanButton(isAnimating: $isAnimating,
isCorrect: viewModel.checkBooleanQuestion(
answer: "False",
questionNumber: currentQuestion
),
buttonText: viewModel.answers.count == 0 ? "" : "False"
)
}
HStack {
BooleanButton(isAnimating: $isAnimating,
isCorrect: viewModel.checkBooleanQuestion(
answer: "True",
questionNumber: currentQuestion
),
buttonText: viewModel.answers.count == 0 ? "" : "True"
)
Spacer()
BooleanButton(isAnimating: $isAnimating,
isCorrect: viewModel.checkBooleanQuestion(
answer: "False",
questionNumber: currentQuestion
),
buttonText: viewModel.answers.count == 0 ? "" : "False"
)
}
case .any:
fatalError("Don't insert .any")
}
Expand All @@ -89,10 +91,10 @@ extension Views {
}
) {
Text("Finish quiz")
}.padding(.bottom, 20)
}
}
}.foregroundColor(DesignSystem.Color.textColorByCategory(category: viewModel.category).uiColor)
.padding(Constants.microPadding)
.padding(DesignSystem.Padding.microPadding)
}
}
}
Expand Down Expand Up @@ -134,11 +136,6 @@ extension Views.QuestionView {
}
}

struct Constants {
static let macroPadding: Double = 32
static let microPadding: Double = 6
}

#if DEBUG
struct QuestionView_Previews: PreviewProvider {
static var previews: some View {
Expand Down

0 comments on commit 6cdec75

Please sign in to comment.