diff --git a/wulkanowy.xcodeproj/project.pbxproj b/wulkanowy.xcodeproj/project.pbxproj index b630550..9c81c40 100644 --- a/wulkanowy.xcodeproj/project.pbxproj +++ b/wulkanowy.xcodeproj/project.pbxproj @@ -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 = ""; }; 96A2D96925D6FEBB001CB109 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = ""; }; 96A2D97A25D7003F001CB109 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; - 96A2D98725D73DCF001CB109 /* OnboardingButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingButtonView.swift; sourceTree = ""; }; + 96A2D98725D73DCF001CB109 /* CustomButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButtonView.swift; sourceTree = ""; }; + 96A5571625D81BD20094BF48 /* CustomTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTextFieldView.swift; sourceTree = ""; }; 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 = ""; }; F4C6D90B2544E17500F8903A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -83,6 +85,7 @@ isa = PBXGroup; children = ( 967B5B9725D813F5006ED944 /* LoginView.swift */, + 96A5571625D81BD20094BF48 /* CustomTextFieldView.swift */, ); path = Login; sourceTree = ""; @@ -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 = ""; }; + 96A5571B25D859460094BF48 /* Shared */ = { + isa = PBXGroup; + children = ( + 96A2D98725D73DCF001CB109 /* CustomButtonView.swift */, + ); + path = Shared; + sourceTree = ""; + }; 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; }; diff --git a/wulkanowy/Assets.xcassets/Colors/OnboardingColor.colorset/Contents.json b/wulkanowy/Assets.xcassets/Colors/PrimaryColor.colorset/Contents.json similarity index 100% rename from wulkanowy/Assets.xcassets/Colors/OnboardingColor.colorset/Contents.json rename to wulkanowy/Assets.xcassets/Colors/PrimaryColor.colorset/Contents.json diff --git a/wulkanowy/Resources/en.lproj/Localizable.strings b/wulkanowy/Resources/en.lproj/Localizable.strings index e167679..82effe9 100644 --- a/wulkanowy/Resources/en.lproj/Localizable.strings +++ b/wulkanowy/Resources/en.lproj/Localizable.strings @@ -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"; diff --git a/wulkanowy/Resources/pl.lproj/Localizable.strings b/wulkanowy/Resources/pl.lproj/Localizable.strings index 6b8b3b3..768ba11 100644 --- a/wulkanowy/Resources/pl.lproj/Localizable.strings +++ b/wulkanowy/Resources/pl.lproj/Localizable.strings @@ -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"; diff --git a/wulkanowy/Views/Login/CustomTextFieldView.swift b/wulkanowy/Views/Login/CustomTextFieldView.swift new file mode 100644 index 0000000..f45bec2 --- /dev/null +++ b/wulkanowy/Views/Login/CustomTextFieldView.swift @@ -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) + } +} diff --git a/wulkanowy/Views/Login/LoginView.swift b/wulkanowy/Views/Login/LoginView.swift index 926f09c..6c60908 100644 --- a/wulkanowy/Views/Login/LoginView.swift +++ b/wulkanowy/Views/Login/LoginView.swift @@ -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() + } } } diff --git a/wulkanowy/Views/Onboarding/OnboardingButtonView.swift b/wulkanowy/Views/Onboarding/OnboardingButtonView.swift deleted file mode 100644 index dde6c5e..0000000 --- a/wulkanowy/Views/Onboarding/OnboardingButtonView.swift +++ /dev/null @@ -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) - } -} diff --git a/wulkanowy/Views/Onboarding/OnboardingView.swift b/wulkanowy/Views/Onboarding/OnboardingView.swift index 7736b27..d4c877d 100644 --- a/wulkanowy/Views/Onboarding/OnboardingView.swift +++ b/wulkanowy/Views/Onboarding/OnboardingView.swift @@ -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() } } diff --git a/wulkanowy/Views/Shared/CustomButtonView.swift b/wulkanowy/Views/Shared/CustomButtonView.swift new file mode 100644 index 0000000..dfe3037 --- /dev/null +++ b/wulkanowy/Views/Shared/CustomButtonView.swift @@ -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) + } +}