Merge pull request #6 from wulkanowy/feature/add-login-view
Added a login screen with needed localizations
This commit is contained in:
commit
1c748cc124
9 changed files with 127 additions and 45 deletions
|
@ -10,7 +10,8 @@
|
|||
967B5B9825D813F5006ED944 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967B5B9725D813F5006ED944 /* LoginView.swift */; };
|
||||
96A2D96325D6FEA6001CB109 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96A2D96525D6FEA6001CB109 /* Localizable.strings */; };
|
||||
96A2D97B25D7003F001CB109 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A2D97A25D7003F001CB109 /* OnboardingView.swift */; };
|
||||
96A2D98825D73DCF001CB109 /* OnboardingButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A2D98725D73DCF001CB109 /* OnboardingButtonView.swift */; };
|
||||
96A2D98825D73DCF001CB109 /* CustomButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A2D98725D73DCF001CB109 /* CustomButtonView.swift */; };
|
||||
96A5571725D81BD20094BF48 /* CustomTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A5571625D81BD20094BF48 /* CustomTextFieldView.swift */; };
|
||||
F4C6D9082544E17400F8903A /* wulkanowyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C6D9072544E17400F8903A /* wulkanowyApp.swift */; };
|
||||
F4C6D90C2544E17500F8903A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4C6D90B2544E17500F8903A /* Assets.xcassets */; };
|
||||
F4C6D90F2544E17500F8903A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4C6D90E2544E17500F8903A /* Preview Assets.xcassets */; };
|
||||
|
@ -40,7 +41,8 @@
|
|||
96A2D96425D6FEA6001CB109 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
96A2D96925D6FEBB001CB109 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
96A2D97A25D7003F001CB109 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
|
||||
96A2D98725D73DCF001CB109 /* OnboardingButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingButtonView.swift; sourceTree = "<group>"; };
|
||||
96A2D98725D73DCF001CB109 /* CustomButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButtonView.swift; sourceTree = "<group>"; };
|
||||
96A5571625D81BD20094BF48 /* CustomTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTextFieldView.swift; sourceTree = "<group>"; };
|
||||
F4C6D9042544E17400F8903A /* wulkanowy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = wulkanowy.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F4C6D9072544E17400F8903A /* wulkanowyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = wulkanowyApp.swift; sourceTree = "<group>"; };
|
||||
F4C6D90B2544E17500F8903A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
|
@ -83,6 +85,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
967B5B9725D813F5006ED944 /* LoginView.swift */,
|
||||
96A5571625D81BD20094BF48 /* CustomTextFieldView.swift */,
|
||||
);
|
||||
path = Login;
|
||||
sourceTree = "<group>";
|
||||
|
@ -106,6 +109,7 @@
|
|||
96A2D96D25D6FF29001CB109 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
96A5571B25D859460094BF48 /* Shared */,
|
||||
967B5B9625D813E2006ED944 /* Login */,
|
||||
96A2D97925D7002D001CB109 /* Onboarding */,
|
||||
);
|
||||
|
@ -116,11 +120,18 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
96A2D97A25D7003F001CB109 /* OnboardingView.swift */,
|
||||
96A2D98725D73DCF001CB109 /* OnboardingButtonView.swift */,
|
||||
);
|
||||
path = Onboarding;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
96A5571B25D859460094BF48 /* Shared */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
96A2D98725D73DCF001CB109 /* CustomButtonView.swift */,
|
||||
);
|
||||
path = Shared;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F4C6D8FB2544E17300F8903A = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -314,7 +325,8 @@
|
|||
F4C6D9082544E17400F8903A /* wulkanowyApp.swift in Sources */,
|
||||
96A2D97B25D7003F001CB109 /* OnboardingView.swift in Sources */,
|
||||
967B5B9825D813F5006ED944 /* LoginView.swift in Sources */,
|
||||
96A2D98825D73DCF001CB109 /* OnboardingButtonView.swift in Sources */,
|
||||
96A5571725D81BD20094BF48 /* CustomTextFieldView.swift in Sources */,
|
||||
96A2D98825D73DCF001CB109 /* CustomButtonView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -11,3 +11,8 @@
|
|||
"onboarding.description.title" = "Keep track of your educational progress with Wulkanowy app!";
|
||||
"onboarding.description.content" = "Wulkanowy allows you to view your grades, attendance, messages from teachers and many more!";
|
||||
"onboarding.continue" = "Continue";
|
||||
|
||||
"login.login" = "Log-in";
|
||||
"login.token" = "Token";
|
||||
"login.symbol" = "Symbol";
|
||||
"login.pin" = "PIN";
|
||||
|
|
|
@ -9,5 +9,10 @@
|
|||
"title" = "Wulkanowy";
|
||||
|
||||
"onboarding.description.title" = "Śledź swoje postępy w nauce za pomocą Wulkanowego!";
|
||||
"onboarding.description.content" = "Wulkanowy pozwala Tobie na sprawdzenie swoich ocen, frewkwencji, wiadomości od nauczycieli i wiele więcej!";
|
||||
"onboarding.description.content" = "Wulkanowy pozwala Tobie na sprawdzenie swoich ocen, frekwencji, wiadomości od nauczycieli i wiele więcej!";
|
||||
"onboarding.continue" = "Kontynuuj";
|
||||
|
||||
"login.login" = "Logowanie";
|
||||
"login.token" = "Token";
|
||||
"login.symbol" = "Symbol";
|
||||
"login.pin" = "PIN";
|
||||
|
|
30
wulkanowy/Views/Login/CustomTextFieldView.swift
Normal file
30
wulkanowy/Views/Login/CustomTextFieldView.swift
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// CustomTextFieldView.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Karol Zientek on 13/02/2021.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CustomTextFieldView: View {
|
||||
|
||||
var placeholder: String
|
||||
|
||||
@State var text: String
|
||||
|
||||
var body: some View {
|
||||
TextField(LocalizedStringKey(placeholder), text: $text)
|
||||
.padding()
|
||||
.background(RoundedRectangle(cornerRadius: 10)
|
||||
.fill(Color.secondary.opacity(0.15)))
|
||||
.keyboardType(.alphabet)
|
||||
.disableAutocorrection(true)
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomTextFieldView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CustomTextFieldView(placeholder: "Token", text: "").previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
|
@ -11,11 +11,36 @@ struct LoginView: View {
|
|||
|
||||
@AppStorage("needsAppOnboarding") private var needsAppOnboarding: Bool = true
|
||||
|
||||
@State private var token: String = ""
|
||||
|
||||
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
.sheet(isPresented: $needsAppOnboarding) {
|
||||
OnboardingView()
|
||||
}
|
||||
VStack {
|
||||
Image("wulkanowy-svg")
|
||||
.resizable()
|
||||
.foregroundColor(Color("PrimaryColor"))
|
||||
.frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/)
|
||||
|
||||
Text("login.login")
|
||||
.font(.largeTitle)
|
||||
.padding(.bottom, 30)
|
||||
|
||||
CustomTextFieldView(placeholder: "login.token", text: "")
|
||||
|
||||
CustomTextFieldView(placeholder: "login.symbol", text: "")
|
||||
|
||||
CustomTextFieldView(placeholder: "login.pin", text: "")
|
||||
|
||||
Spacer()
|
||||
|
||||
CustomButtonView(action: {
|
||||
print("Works")
|
||||
}, title: "login.login")
|
||||
}
|
||||
.padding([.top, .horizontal], 20)
|
||||
.sheet(isPresented: $needsAppOnboarding) {
|
||||
OnboardingView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// OnboardingButtonView.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Karol Zientek on 12/02/2021.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingButtonView: View {
|
||||
|
||||
@AppStorage("needsAppOnboarding") var needsAppOnboarding: Bool = true
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
needsAppOnboarding = false
|
||||
}, label: {
|
||||
Text("onboarding.continue")
|
||||
})
|
||||
.padding(10)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(Color("OnboardingColor"))
|
||||
.foregroundColor(.white)
|
||||
.font(.title)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingButtonView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OnboardingButtonView()
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
|
@ -9,13 +9,15 @@ import SwiftUI
|
|||
|
||||
struct OnboardingView: View {
|
||||
|
||||
@AppStorage("needsAppOnboarding") private var needsAppOnboarding: Bool = true
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Spacer()
|
||||
Image("wulkanowy-svg")
|
||||
.resizable()
|
||||
.frame(width: 200, height: 200, alignment: .top)
|
||||
.foregroundColor(Color("OnboardingColor"))
|
||||
.foregroundColor(Color("PrimaryColor"))
|
||||
VStack(spacing: 20) {
|
||||
Text("onboarding.description.title")
|
||||
.font(.headline)
|
||||
|
@ -26,7 +28,9 @@ struct OnboardingView: View {
|
|||
}
|
||||
.padding(.horizontal, 20)
|
||||
Spacer()
|
||||
OnboardingButtonView()
|
||||
CustomButtonView(action: {
|
||||
needsAppOnboarding = false
|
||||
}, title: "onboarding.continue")
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
|
35
wulkanowy/Views/Shared/CustomButtonView.swift
Normal file
35
wulkanowy/Views/Shared/CustomButtonView.swift
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// CustomButtonView.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Karol Zientek on 12/02/2021.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CustomButtonView: View {
|
||||
|
||||
var action: () -> ()
|
||||
var title: String
|
||||
|
||||
var body: some View {
|
||||
Button(action: action, label: {
|
||||
Text(LocalizedStringKey(title))
|
||||
})
|
||||
.padding(10)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(Color("PrimaryColor"))
|
||||
.foregroundColor(.white)
|
||||
.font(.title)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomButtonView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CustomButtonView(action: {
|
||||
print("Button tapped!")
|
||||
}, title: "Test")
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue