From 546e6d74b0926889bfa80a55dd0f3f99843ef599 Mon Sep 17 00:00:00 2001 From: Saeed Bashir Date: Fri, 29 Mar 2024 14:16:21 +0500 Subject: [PATCH] chore: design team feedback to improve app theming capability (#365) * chore: design team feedback to improve app theming capability * chore: resolve conflicts * chore: address review feedback * chore: revert and update sign in & sign up subtitles --- .../Presentation/Base/FieldsView.swift | 2 +- .../Presentation/Login/SignInView.swift | 29 ++++++----- .../Registration/SignUpView.swift | 6 +-- .../Reset Password/ResetPasswordView.swift | 11 +++-- .../Presentation/Startup/StartupView.swift | 17 ++++--- .../Authorization/SwiftGen/Strings.swift | 10 ++-- .../en.lproj/Localizable.strings | 5 +- .../uk.lproj/Localizable.strings | 5 +- Core/Core/SwiftGen/Strings.swift | 4 +- .../View/Base/FlexibleKeyboardInputView.swift | 15 +++--- .../View/Base/LogistrationBottomView.swift | 4 +- Core/Core/View/Base/PickerMenu.swift | 18 +++++-- Core/Core/View/Base/PickerView.swift | 2 +- .../View/Base/RegistrationTextField.swift | 5 +- Core/Core/en.lproj/Localizable.strings | 2 +- Core/Core/uk.lproj/Localizable.strings | 2 +- .../Subviews/LessonLineProgressView.swift | 2 +- .../NativeDiscovery/SearchView.swift | 2 +- .../CreateNewThread/CreateNewThreadView.swift | 8 ++-- .../DiscussionSearchTopicsView.swift | 27 +++++------ .../DiscussionTopicsView.swift | 6 +-- .../DeleteAccount/DeleteAccountView.swift | 19 ++++---- .../EditProfile/EditProfileView.swift | 2 +- .../InfoColor.colorset copy/Contents.json | 38 +++++++++++++++ .../Colors/InfoColor.colorset/Contents.json | 38 +++++++++++++++ .../Contents.json | 38 +++++++++++++++ .../IrreversibleAlert.colorset/Contents.json | 38 +++++++++++++++ .../Contents.json | 38 +++++++++++++++ .../TextInputTextColor.colorset/Contents.json | 38 +++++++++++++++ Theme/Theme/SwiftGen/ThemeAssets.swift | 4 ++ Theme/Theme/Theme.swift | 48 ++++++++++++++++++- 31 files changed, 389 insertions(+), 94 deletions(-) create mode 100644 Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset copy/Contents.json create mode 100644 Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset/Contents.json create mode 100644 Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset copy/Contents.json create mode 100644 Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset/Contents.json create mode 100644 Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputPlaceholderColor.colorset/Contents.json create mode 100644 Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputTextColor.colorset/Contents.json diff --git a/Authorization/Authorization/Presentation/Base/FieldsView.swift b/Authorization/Authorization/Presentation/Base/FieldsView.swift index d05eac80f..e69cce798 100644 --- a/Authorization/Authorization/Presentation/Base/FieldsView.swift +++ b/Authorization/Authorization/Presentation/Base/FieldsView.swift @@ -94,7 +94,7 @@ struct FieldsView: View { } } Text(.init(text)) - .tint(Theme.Colors.accentXColor) + .tint(Theme.Colors.infoColor) .foregroundStyle(Theme.Colors.textSecondaryLight) .font(Theme.Fonts.labelSmall) .padding(.vertical, 3) diff --git a/Authorization/Authorization/Presentation/Login/SignInView.swift b/Authorization/Authorization/Presentation/Login/SignInView.swift index c3a45ab15..f56698803 100644 --- a/Authorization/Authorization/Presentation/Login/SignInView.swift +++ b/Authorization/Authorization/Presentation/Login/SignInView.swift @@ -70,22 +70,24 @@ public struct SignInView: View { .foregroundColor(Theme.Colors.textPrimary) .padding(.bottom, 20) .accessibilityIdentifier("welcome_back_text") - Text(AuthLocalization.SignIn.emailOrUsername) .font(Theme.Fonts.labelLarge) .foregroundColor(Theme.Colors.textPrimary) .accessibilityIdentifier("username_text") - TextField(AuthLocalization.SignIn.emailOrUsername, text: $email) + TextField("", text: $email) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .keyboardType(.emailAddress) .textContentType(.emailAddress) .autocapitalization(.none) .autocorrectionDisabled() .padding(.all, 14) .background( - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) + Theme.InputFieldBackground( + placeHolder: AuthLocalization.SignIn.emailOrUsername, + text: email, + padding: 15 + ) ) .overlay( Theme.Shapes.textInputShape @@ -99,13 +101,16 @@ public struct SignInView: View { .foregroundColor(Theme.Colors.textPrimary) .padding(.top, 18) .accessibilityIdentifier("password_text") - SecureField(AuthLocalization.SignIn.password, text: $password) + SecureField("", text: $password) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.all, 14) .background( - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) + Theme.InputFieldBackground( + placeHolder: AuthLocalization.SignIn.password, + text: password, + padding: 15 + ) ) .overlay( Theme.Shapes.textInputShape @@ -115,7 +120,7 @@ public struct SignInView: View { .accessibilityIdentifier("password_textfield") HStack { if !viewModel.config.features.startupScreenEnabled { - Button(CoreLocalization.SignIn.registerBtn) { + Button(CoreLocalization.register) { viewModel.router.showRegisterScreen(sourceScreen: viewModel.sourceScreen) } .foregroundColor(Theme.Colors.accentColor) @@ -129,7 +134,7 @@ public struct SignInView: View { viewModel.router.showForgotPasswordScreen() } .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.accentXColor) + .foregroundColor(Theme.Colors.infoColor) .padding(.top, 0) .accessibilityIdentifier("forgot_password_button") } @@ -222,7 +227,7 @@ public struct SignInView: View { policy ) Text(.init(text)) - .tint(Theme.Colors.accentXColor) + .tint(Theme.Colors.infoColor) .foregroundStyle(Theme.Colors.textSecondaryLight) .font(Theme.Fonts.labelSmall) .padding(.top, viewModel.socialAuthEnabled ? 0 : 15) diff --git a/Authorization/Authorization/Presentation/Registration/SignUpView.swift b/Authorization/Authorization/Presentation/Registration/SignUpView.swift index 6dec70a19..fb9614ceb 100644 --- a/Authorization/Authorization/Presentation/Registration/SignUpView.swift +++ b/Authorization/Authorization/Presentation/Registration/SignUpView.swift @@ -40,7 +40,7 @@ public struct SignUpView: View { VStack(alignment: .center) { ZStack { HStack { - Text(CoreLocalization.SignIn.registerBtn) + Text(CoreLocalization.register) .titleSettings(color: Theme.Colors.loginNavigationText) .accessibilityIdentifier("register_text") } @@ -63,7 +63,7 @@ public struct SignUpView: View { ScrollView { VStack(alignment: .leading) { - Text(AuthLocalization.SignUp.title) + Text(CoreLocalization.register) .font(Theme.Fonts.displaySmall) .foregroundColor(Theme.Colors.textPrimary) .padding(.bottom, 4) @@ -73,7 +73,7 @@ public struct SignUpView: View { .foregroundColor(Theme.Colors.textPrimary) .padding(.bottom, 20) .accessibilityIdentifier("signup_subtitle_text") - + if viewModel.thirdPartyAuthSuccess { Text(AuthLocalization.SignUp.successSigninLabel) .font(Theme.Fonts.titleMedium) diff --git a/Authorization/Authorization/Presentation/Reset Password/ResetPasswordView.swift b/Authorization/Authorization/Presentation/Reset Password/ResetPasswordView.swift index 256b60f97..a66562028 100644 --- a/Authorization/Authorization/Presentation/Reset Password/ResetPasswordView.swift +++ b/Authorization/Authorization/Presentation/Reset Password/ResetPasswordView.swift @@ -92,17 +92,20 @@ public struct ResetPasswordView: View { .font(Theme.Fonts.labelLarge) .foregroundColor(Theme.Colors.textPrimary) .accessibilityIdentifier("email_text") - TextField(AuthLocalization.SignIn.email, text: $email) + TextField("", text: $email) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .keyboardType(.emailAddress) .textContentType(.emailAddress) .autocapitalization(.none) .autocorrectionDisabled() .padding(.all, 14) .background( - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) + Theme.InputFieldBackground( + placeHolder: AuthLocalization.SignIn.email, + text: email, + padding: 15 + ) ) .overlay( Theme.Shapes.textInputShape diff --git a/Authorization/Authorization/Presentation/Startup/StartupView.swift b/Authorization/Authorization/Presentation/Startup/StartupView.swift index f0ac99841..b8b3db370 100644 --- a/Authorization/Authorization/Presentation/Startup/StartupView.swift +++ b/Authorization/Authorization/Presentation/Startup/StartupView.swift @@ -55,8 +55,8 @@ public struct StartupView: View { Image(systemName: "magnifyingglass") .padding(.leading, 16) .padding(.top, 1) - .foregroundColor(Theme.Colors.textPrimary) - TextField(AuthLocalization.Startup.searchPlaceholder, text: $searchQuery, onCommit: { + .foregroundColor(Theme.Colors.textInputTextColor) + TextField("", text: $searchQuery, onCommit: { if searchQuery.isEmpty { return } viewModel.router.showDiscoveryScreen( searchQuery: searchQuery, @@ -68,7 +68,7 @@ public struct StartupView: View { .frame(minHeight: 50) .submitLabel(.search) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .accessibilityIdentifier("explore_courses_textfield") }.overlay( @@ -77,19 +77,22 @@ public struct StartupView: View { .fill(Theme.Colors.textInputStroke) ) .background( - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) + Theme.InputFieldBackground( + placeHolder: AuthLocalization.Startup.searchPlaceholder, + text: searchQuery, + padding: 48 + ) ) Button { - viewModel.router.showDiscoveryScreen ( + viewModel.router.showDiscoveryScreen( searchQuery: searchQuery, sourceScreen: .startup ) } label: { Text(AuthLocalization.Startup.exploreAllCourses) .underline() - .foregroundColor(Theme.Colors.accentXColor) + .foregroundColor(Theme.Colors.infoColor) .font(Theme.Fonts.bodyLarge) } .padding(.top, isHorizontal ? 0 : 5) diff --git a/Authorization/Authorization/SwiftGen/Strings.swift b/Authorization/Authorization/SwiftGen/Strings.swift index 2a28a0db4..a977c2cae 100644 --- a/Authorization/Authorization/SwiftGen/Strings.swift +++ b/Authorization/Authorization/SwiftGen/Strings.swift @@ -69,8 +69,8 @@ public enum AuthLocalization { public static let logInTitle = AuthLocalization.tr("Localizable", "SIGN_IN.LOG_IN_TITLE", fallback: "Sign in") /// Password public static let password = AuthLocalization.tr("Localizable", "SIGN_IN.PASSWORD", fallback: "Password") - /// Welcome back! Please authorize to continue. - public static let welcomeBack = AuthLocalization.tr("Localizable", "SIGN_IN.WELCOME_BACK", fallback: "Welcome back! Please authorize to continue.") + /// Welcome back! Sign in to access your courses. + public static let welcomeBack = AuthLocalization.tr("Localizable", "SIGN_IN.WELCOME_BACK", fallback: "Welcome back! Sign in to access your courses.") } public enum SignUp { /// By creating an account, you agree to the [%@ End User License Agreement](%@) and [%@ Terms of Service and Honor Code](%@) and you acknowledge that %@ and each Member process your personal data inaccordance with the [Privacy Policy.](%@) @@ -87,14 +87,12 @@ public enum AuthLocalization { } /// Show optional Fields public static let showFields = AuthLocalization.tr("Localizable", "SIGN_UP.SHOW_FIELDS", fallback: "Show optional Fields") - /// Create new account. - public static let subtitle = AuthLocalization.tr("Localizable", "SIGN_UP.SUBTITLE", fallback: "Create new account.") + /// Create an account to start learning today! + public static let subtitle = AuthLocalization.tr("Localizable", "SIGN_UP.SUBTITLE", fallback: "Create an account to start learning today!") /// You've successfully signed in. public static let successSigninLabel = AuthLocalization.tr("Localizable", "SIGN_UP.SUCCESS_SIGNIN_LABEL", fallback: "You've successfully signed in.") /// We just need a little more information before you start learning. public static let successSigninSublabel = AuthLocalization.tr("Localizable", "SIGN_UP.SUCCESS_SIGNIN_SUBLABEL", fallback: "We just need a little more information before you start learning.") - /// Sign up - public static let title = AuthLocalization.tr("Localizable", "SIGN_UP.TITLE", fallback: "Sign up") } public enum Startup { /// Explore all courses diff --git a/Authorization/Authorization/en.lproj/Localizable.strings b/Authorization/Authorization/en.lproj/Localizable.strings index 6133ff62f..9b776c4b9 100644 --- a/Authorization/Authorization/en.lproj/Localizable.strings +++ b/Authorization/Authorization/en.lproj/Localizable.strings @@ -7,7 +7,7 @@ */ "SIGN_IN.LOG_IN_TITLE" = "Sign in"; -"SIGN_IN.WELCOME_BACK" = "Welcome back! Please authorize to continue."; +"SIGN_IN.WELCOME_BACK" = "Welcome back! Sign in to access your courses."; "SIGN_IN.EMAIL" = "Email"; "SIGN_IN.EMAIL_OR_USERNAME" = "Email or username"; "SIGN_IN.PASSWORD" = "Password"; @@ -22,8 +22,7 @@ accordance with the [Privacy Policy.](%@)"; "ERROR.INVALID_EMAIL_ADDRESS_OR_USERNAME" = "Invalid email or username"; "ERROR.DISABLED_ACCOUNT" = "Your account is disabled. Please contact customer support for assistance."; -"SIGN_UP.TITLE" = "Sign up"; -"SIGN_UP.SUBTITLE" = "Create new account."; +"SIGN_UP.SUBTITLE" = "Create an account to start learning today!"; "SIGN_UP.CREATE_ACCOUNT_BTN" = "Create account"; "SIGN_UP.HIDE_FIELDS" = "Hide optional Fields"; "SIGN_UP.SHOW_FIELDS" = "Show optional Fields"; diff --git a/Authorization/Authorization/uk.lproj/Localizable.strings b/Authorization/Authorization/uk.lproj/Localizable.strings index 3cd9772d4..e341b0ebd 100644 --- a/Authorization/Authorization/uk.lproj/Localizable.strings +++ b/Authorization/Authorization/uk.lproj/Localizable.strings @@ -7,7 +7,7 @@ */ "SIGN_IN.LOG_IN_TITLE" = "Увійти"; -"SIGN_IN.WELCOME_BACK" = "З поверненням! Авторизуйтесь, щоб продовжити."; +"SIGN_IN.WELCOME_BACK" = "Welcome back! Sign in to access your courses."; "SIGN_IN.EMAIL" = "Пошта"; "SIGN_IN.PASSWORD" = "Пароль"; "SIGN_IN.FORGOT_PASS_BTN" = "Забули пароль?"; @@ -19,8 +19,7 @@ accordance with the [Privacy Policy.](%@)"; "ERROR.ACCOUNT_NOT_REGISTERED" = "This %@ account is not linked with any %@ account. Please register."; "ERROR.DISABLED_ACCOUNT" = "Your account is disabled. Please contact customer support for assistance."; -"SIGN_UP.TITLE" = "Зареєструватись"; -"SIGN_UP.SUBTITLE" = "Cтворити новий акаунт."; +"SIGN_UP.SUBTITLE" = "Create an account to start learning today!"; "SIGN_UP.CREATE_ACCOUNT_BTN" = "Створити акаунт"; "SIGN_UP.HIDE_FIELDS" = "Приховати необовʼязкові поля"; "SIGN_UP.SHOW_FIELDS" = "Показати необовʼязкові поля"; diff --git a/Core/Core/SwiftGen/Strings.swift b/Core/Core/SwiftGen/Strings.swift index d47476385..a5782d497 100644 --- a/Core/Core/SwiftGen/Strings.swift +++ b/Core/Core/SwiftGen/Strings.swift @@ -14,6 +14,8 @@ public enum CoreLocalization { public static let done = CoreLocalization.tr("Localizable", "DONE", fallback: "Done") /// View in Safari public static let openInBrowser = CoreLocalization.tr("Localizable", "OPEN_IN_BROWSER", fallback: "View in Safari") + /// Register + public static let register = CoreLocalization.tr("Localizable", "REGISTER", fallback: "Register") /// The user canceled the sign-in flow. public static let socialSignCanceled = CoreLocalization.tr("Localizable", "SOCIAL_SIGN_CANCELED", fallback: "The user canceled the sign-in flow.") /// Tomorrow @@ -208,8 +210,6 @@ public enum CoreLocalization { public enum SignIn { /// Sign in public static let logInBtn = CoreLocalization.tr("Localizable", "SIGN_IN.LOG_IN_BTN", fallback: "Sign in") - /// Register - public static let registerBtn = CoreLocalization.tr("Localizable", "SIGN_IN.REGISTER_BTN", fallback: "Register") } public enum View { public enum Snackbar { diff --git a/Core/Core/View/Base/FlexibleKeyboardInputView.swift b/Core/Core/View/Base/FlexibleKeyboardInputView.swift index 60dfc5085..48a1119f5 100644 --- a/Core/Core/View/Base/FlexibleKeyboardInputView.swift +++ b/Core/Core/View/Base/FlexibleKeyboardInputView.swift @@ -53,18 +53,15 @@ public struct FlexibleKeyboardInputView: View { .overlay( TextEditor(text: $commentText) .padding(.horizontal, 8) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .hideScrollContentBackground() .frame(maxHeight: commentSize) .background( - ZStack(alignment: .leading) { - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) - Text(commentText.count == 0 ? hint : "") - .foregroundColor(Theme.Colors.textSecondary) - .font(Theme.Fonts.labelLarge) - .padding(.leading, 14) - } + Theme.InputFieldBackground( + placeHolder: commentText.count == 0 ? hint : "", + text: commentText, + padding: 14 + ) ) .overlay( Theme.Shapes.textInputShape diff --git a/Core/Core/View/Base/LogistrationBottomView.swift b/Core/Core/View/Base/LogistrationBottomView.swift index 776ab12d2..fca95cc04 100644 --- a/Core/Core/View/Base/LogistrationBottomView.swift +++ b/Core/Core/View/Base/LogistrationBottomView.swift @@ -38,7 +38,7 @@ public struct LogistrationBottomView: View { public var body: some View { VStack(alignment: .leading) { HStack(spacing: 24) { - StyledButton(CoreLocalization.SignIn.registerBtn) { + StyledButton(CoreLocalization.register) { action(.register) } .accessibilityIdentifier("logistration_register_button") @@ -48,7 +48,7 @@ public struct LogistrationBottomView: View { action: { action(.signIn) }, - color: Theme.Colors.white, + color: Theme.Colors.background, textColor: Theme.Colors.secondaryButtonTextColor, borderColor: Theme.Colors.secondaryButtonBorderColor ) diff --git a/Core/Core/View/Base/PickerMenu.swift b/Core/Core/View/Base/PickerMenu.swift index 2066a8aa0..0de023381 100644 --- a/Core/Core/View/Base/PickerMenu.swift +++ b/Core/Core/View/Base/PickerMenu.swift @@ -83,10 +83,20 @@ public struct PickerMenu: View { .foregroundColor(Theme.Colors.textPrimary) .accessibilityIdentifier("picker_title_text") .font(Theme.Fonts.bodyMedium) - TextField(CoreLocalization.Picker.search, text: $search) + TextField("", text: $search) .padding(.all, 8) .font(Theme.Fonts.bodySmall) - .background(Theme.Colors.textInputStroke.cornerRadius(6)) + .overlay( + Theme.Shapes.textInputShape + .stroke(lineWidth: 1) + .fill(Theme.Colors.textInputStroke) + ) + .background( + Theme.InputFieldBackground( + placeHolder: CoreLocalization.Picker.search, + text: search + ) + ) .accessibilityIdentifier("picker_search_textfield") Picker("", selection: $selectedItem) { ForEach(filteredItems, id: \.self) { item in @@ -104,7 +114,7 @@ public struct PickerMenu: View { : .infinity) .padding() - .background(Theme.Colors.textInputBackground.cornerRadius(16)) + .background(Theme.Colors.background.cornerRadius(16)) .padding(.horizontal, 16) .onChange(of: search, perform: { _ in if let first = filteredItems.first { @@ -124,7 +134,7 @@ public struct PickerMenu: View { ? ipadPickerWidth : .infinity) .padding() - .background(Theme.Colors.textInputBackground.cornerRadius(16)) + .background(Theme.Colors.background.cornerRadius(16)) .padding(.horizontal, 16) } .padding(.bottom, 4) diff --git a/Core/Core/View/Base/PickerView.swift b/Core/Core/View/Base/PickerView.swift index 868a5e600..d0655ddb4 100644 --- a/Core/Core/View/Base/PickerView.swift +++ b/Core/Core/View/Base/PickerView.swift @@ -54,7 +54,7 @@ public struct PickerView: View { }) .accessibilityIdentifier("\(config.field.name)_picker_button") }.padding(.all, 14) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .background( Theme.Shapes.textInputShape .fill(Theme.Colors.textInputBackground) diff --git a/Core/Core/View/Base/RegistrationTextField.swift b/Core/Core/View/Base/RegistrationTextField.swift index a6751451b..9ed039763 100644 --- a/Core/Core/View/Base/RegistrationTextField.swift +++ b/Core/Core/View/Base/RegistrationTextField.swift @@ -43,9 +43,10 @@ public struct RegistrationTextField: View { if isTextArea { TextEditor(text: $config.text) .font(Theme.Fonts.bodyMedium) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.horizontal, 12) .padding(.vertical, 4) + .foregroundColor(Theme.Colors.textInputTextColor) .frame(height: 100) .hideScrollContentBackground() .background( @@ -90,7 +91,7 @@ public struct RegistrationTextField: View { } else { TextField(placeholder, text: $config.text) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .keyboardType(keyboardType) .textContentType(textContentType) .autocapitalization(.none) diff --git a/Core/Core/en.lproj/Localizable.strings b/Core/Core/en.lproj/Localizable.strings index 8d868b239..27196487a 100644 --- a/Core/Core/en.lproj/Localizable.strings +++ b/Core/Core/en.lproj/Localizable.strings @@ -108,7 +108,7 @@ "SOCIAL_SIGN_CANCELED" = "The user canceled the sign-in flow."; "SIGN_IN.LOG_IN_BTN" = "Sign in"; -"SIGN_IN.REGISTER_BTN" = "Register"; +"REGISTER" = "Register"; "TOMORROW" = "Tomorrow"; "YESTERDAY" = "Yesterday"; diff --git a/Core/Core/uk.lproj/Localizable.strings b/Core/Core/uk.lproj/Localizable.strings index ce8cc2ac5..1da07ab04 100644 --- a/Core/Core/uk.lproj/Localizable.strings +++ b/Core/Core/uk.lproj/Localizable.strings @@ -107,7 +107,7 @@ "AUTHORIZATION_FAILED" = "Authorization failed."; "SIGN_IN.LOG_IN_BTN" = "Увійти"; -"SIGN_IN.REGISTER_BTN" = "Реєстрація"; +"REGISTER" = "Реєстрація"; "TOMORROW" = "Tomorrow"; "YESTERDAY" = "Yesterday"; diff --git a/Course/Course/Presentation/Unit/Subviews/LessonLineProgressView.swift b/Course/Course/Presentation/Unit/Subviews/LessonLineProgressView.swift index 17ae05de2..b569a4f65 100644 --- a/Course/Course/Presentation/Unit/Subviews/LessonLineProgressView.swift +++ b/Course/Course/Presentation/Unit/Subviews/LessonLineProgressView.swift @@ -20,7 +20,7 @@ struct LessonLineProgressView: View { var body: some View { ZStack(alignment: .bottom) { Theme.Colors.background - HStack(spacing: 3) { + HStack(spacing: 8) { let vertical = viewModel.verticals[viewModel.verticalIndex] let data = Array(vertical.childs.enumerated()) ForEach(data, id: \.offset) { index, item in diff --git a/Discovery/Discovery/Presentation/NativeDiscovery/SearchView.swift b/Discovery/Discovery/Presentation/NativeDiscovery/SearchView.swift index 7f123a28a..065147d95 100644 --- a/Discovery/Discovery/Presentation/NativeDiscovery/SearchView.swift +++ b/Discovery/Discovery/Presentation/NativeDiscovery/SearchView.swift @@ -60,7 +60,7 @@ public struct SearchView: View { .onAppear { self.focused = true } - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .font(Theme.Fonts.bodyLarge) .accessibilityIdentifier("search_textfields") Spacer() diff --git a/Discussion/Discussion/Presentation/CreateNewThread/CreateNewThreadView.swift b/Discussion/Discussion/Presentation/CreateNewThread/CreateNewThreadView.swift index 0d031e983..7c676df8d 100644 --- a/Discussion/Discussion/Presentation/CreateNewThread/CreateNewThreadView.swift +++ b/Discussion/Discussion/Presentation/CreateNewThread/CreateNewThreadView.swift @@ -86,10 +86,12 @@ public struct CreateNewThreadView: View { Text(viewModel.allTopics.first(where: { $0.id == viewModel.selectedTopic })?.name ?? "") .font(Theme.Fonts.labelLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .frame(height: 40, alignment: .leading) Spacer() Image(systemName: "chevron.down") + .renderingMode(.template) + .foregroundColor(Theme.Colors.textInputTextColor) }.padding(.horizontal, 14) .accentColor(Theme.Colors.textPrimary) .background(Theme.Shapes.textInputShape @@ -112,7 +114,7 @@ public struct CreateNewThreadView: View { }.padding(.top, 16) TextField("", text: $postTitle) .font(Theme.Fonts.bodyLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(14) .frame(height: 40) .background( @@ -135,7 +137,7 @@ public struct CreateNewThreadView: View { }.padding(.top, 16) TextEditor(text: $postBody) .font(Theme.Fonts.bodyMedium) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.horizontal, 10) .padding(.vertical, 10) .frame(height: 200) diff --git a/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionSearchTopicsView.swift b/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionSearchTopicsView.swift index 360df3d78..de306714b 100644 --- a/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionSearchTopicsView.swift +++ b/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionSearchTopicsView.swift @@ -33,19 +33,14 @@ public struct DiscussionSearchTopicsView: View { HStack(spacing: 11) { Image(systemName: "magnifyingglass") - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.leading, 16) .padding(.top, -1) .foregroundColor( - viewModel.isSearchActive - ? Theme.Colors.accentColor - : Theme.Colors.textPrimary + Theme.Colors.textInputTextColor ) - TextField( - !viewModel.isSearchActive - ? DiscussionLocalization.search - : "", + TextField("", text: $viewModel.searchText, onEditingChanged: { editing in viewModel.isSearchActive = editing @@ -54,7 +49,7 @@ public struct DiscussionSearchTopicsView: View { .onAppear { self.focused = true } - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .font(Theme.Fonts.bodyMedium) Spacer() if !viewModel.searchText.trimmingCharacters(in: .whitespaces).isEmpty { @@ -68,19 +63,21 @@ public struct DiscussionSearchTopicsView: View { .foregroundColor(Theme.Colors.styledButtonText) } } - // .padding(.top, -7) .frame(minHeight: 48) .background( - Theme.Shapes.textInputShape - .fill(viewModel.isSearchActive - ? Theme.Colors.textInputBackground - : Theme.Colors.textInputUnfocusedBackground) + Theme.InputFieldBackground( + placeHolder: !viewModel.isSearchActive + ? DiscussionLocalization.search + : "", + text: viewModel.searchText, + padding: 48 + ) ) .overlay( Theme.Shapes.textInputShape .stroke(lineWidth: 1) .fill(viewModel.isSearchActive - ? Theme.Colors.accentColor + ? Theme.Colors.textInputTextColor : Theme.Colors.textInputUnfocusedStroke) ) .frameLimit(width: proxy.size.width) diff --git a/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionTopicsView.swift b/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionTopicsView.swift index c959ed2a9..b6fb46c31 100644 --- a/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionTopicsView.swift +++ b/Discussion/Discussion/Presentation/DiscussionTopics/DiscussionTopicsView.swift @@ -29,18 +29,18 @@ public struct DiscussionTopicsView: View { // MARK: - Search fake field HStack(spacing: 11) { Image(systemName: "magnifyingglass") - .foregroundColor(Theme.Colors.textSecondary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.leading, 16) .padding(.top, 1) Text(DiscussionLocalization.Topics.search) - .foregroundColor(Theme.Colors.textSecondary) + .foregroundColor(Theme.Colors.textInputTextColor) .font(Theme.Fonts.bodyMedium) Spacer() } .frame(minHeight: 48) .background( Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputUnfocusedBackground) + .fill(Theme.Colors.textInputBackground) ) .overlay( Theme.Shapes.textInputShape diff --git a/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift b/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift index 105715367..3f6fc6fe1 100644 --- a/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift +++ b/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift @@ -39,7 +39,7 @@ public struct DeleteAccountView: View { Text(ProfileLocalization.DeleteAccount.areYouSure) .foregroundColor(Theme.Colors.navigationBarTintColor) + Text(ProfileLocalization.DeleteAccount.wantToDelete) - .foregroundColor(Theme.Colors.alert) + .foregroundColor(Theme.Colors.irreversibleAlert) } .accessibilityIdentifier("are_you_sure_text") @@ -63,18 +63,21 @@ public struct DeleteAccountView: View { .accessibilityIdentifier("password_text") HStack(spacing: 11) { - SecureField(ProfileLocalization.DeleteAccount.passwordDescription, + SecureField("", text: $viewModel.password) .font(Theme.Fonts.labelLarge) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .accessibilityIdentifier("password_textfield") } .padding(.horizontal, 14) .frame(minHeight: 48) .frame(maxWidth: .infinity) .background( - Theme.Shapes.textInputShape - .fill(Theme.Colors.textInputBackground) + Theme.InputFieldBackground( + placeHolder: ProfileLocalization.DeleteAccount.passwordDescription, + text: viewModel.password, + padding: 15 + ) ) .overlay( Theme.Shapes.textInputShape @@ -84,7 +87,7 @@ public struct DeleteAccountView: View { Text(viewModel.incorrectPassword ? ProfileLocalization.DeleteAccount.incorrectPassword : " ") - .foregroundColor(Theme.Colors.alert) + .foregroundColor(Theme.Colors.irreversibleAlert) .font(Theme.Fonts.labelLarge) .multilineTextAlignment(.leading) .padding(.top, 0) @@ -111,8 +114,8 @@ public struct DeleteAccountView: View { } }, color: .clear, - textColor: Theme.Colors.alert, - borderColor: Theme.Colors.alert, + textColor: Theme.Colors.irreversibleAlert, + borderColor: Theme.Colors.irreversibleAlert, isActive: viewModel.password.count >= 2 ) .padding(.top, 18) diff --git a/Profile/Profile/Presentation/EditProfile/EditProfileView.swift b/Profile/Profile/Presentation/EditProfile/EditProfileView.swift index 8909ddfc6..86927376f 100644 --- a/Profile/Profile/Presentation/EditProfile/EditProfileView.swift +++ b/Profile/Profile/Presentation/EditProfile/EditProfileView.swift @@ -86,7 +86,7 @@ public struct EditProfileView: View { .accessibilityIdentifier("about_text") TextEditor(text: $viewModel.profileChanges.shortBiography) .font(Theme.Fonts.bodyMedium) - .foregroundColor(Theme.Colors.textPrimary) + .foregroundColor(Theme.Colors.textInputTextColor) .padding(.horizontal, 12) .padding(.vertical, 4) .frame(height: 200) diff --git a/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset copy/Contents.json b/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset copy/Contents.json new file mode 100644 index 000000000..00d59cb46 --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset copy/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "0.408", + "red" : "0.235" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.976", + "green" : "0.471", + "red" : "0.329" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset/Contents.json b/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset/Contents.json new file mode 100644 index 000000000..00d59cb46 --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/InfoColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "0.408", + "red" : "0.235" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.976", + "green" : "0.471", + "red" : "0.329" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset copy/Contents.json b/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset copy/Contents.json new file mode 100644 index 000000000..14e0c379b --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset copy/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.443", + "green" : "0.239", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.443", + "green" : "0.239", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset/Contents.json b/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset/Contents.json new file mode 100644 index 000000000..14e0c379b --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/IrreversibleAlert.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.443", + "green" : "0.239", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.443", + "green" : "0.239", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputPlaceholderColor.colorset/Contents.json b/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputPlaceholderColor.colorset/Contents.json new file mode 100644 index 000000000..93691d3e8 --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputPlaceholderColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.733", + "green" : "0.647", + "red" : "0.592" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.624", + "green" : "0.533", + "red" : "0.475" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputTextColor.colorset/Contents.json b/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputTextColor.colorset/Contents.json new file mode 100644 index 000000000..a3f0c654a --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/TextInput/TextInputTextColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.184", + "green" : "0.129", + "red" : "0.098" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/SwiftGen/ThemeAssets.swift b/Theme/Theme/SwiftGen/ThemeAssets.swift index 4eeb5d2c3..c6204d609 100644 --- a/Theme/Theme/SwiftGen/ThemeAssets.swift +++ b/Theme/Theme/SwiftGen/ThemeAssets.swift @@ -43,6 +43,8 @@ public enum ThemeAssets { public static let todayTimelineColor = ColorAsset(name: "TodayTimelineColor") public static let upcomingTimelineColor = ColorAsset(name: "UpcomingTimelineColor") public static let pastDueTimelineColor = ColorAsset(name: "pastDueTimelineColor") + public static let infoColor = ColorAsset(name: "InfoColor") + public static let irreversibleAlert = ColorAsset(name: "IrreversibleAlert") public static let loginBackground = ColorAsset(name: "LoginBackground") public static let loginNavigationText = ColorAsset(name: "LoginNavigationText") public static let primaryButtonTextColor = ColorAsset(name: "PrimaryButtonTextColor") @@ -64,7 +66,9 @@ public enum ThemeAssets { public static let textSecondary = ColorAsset(name: "TextSecondary") public static let textSecondaryLight = ColorAsset(name: "TextSecondaryLight") public static let textInputBackground = ColorAsset(name: "TextInputBackground") + public static let textInputPlaceholderColor = ColorAsset(name: "TextInputPlaceholderColor") public static let textInputStroke = ColorAsset(name: "TextInputStroke") + public static let textInputTextColor = ColorAsset(name: "TextInputTextColor") public static let textInputUnfocusedBackground = ColorAsset(name: "TextInputUnfocusedBackground") public static let textInputUnfocusedStroke = ColorAsset(name: "TextInputUnfocusedStroke") public static let toggleSwitchColor = ColorAsset(name: "ToggleSwitchColor") diff --git a/Theme/Theme/Theme.swift b/Theme/Theme/Theme.swift index 473eb9c0a..fba4e1b06 100644 --- a/Theme/Theme/Theme.swift +++ b/Theme/Theme/Theme.swift @@ -60,6 +60,10 @@ public struct Theme { public private(set) static var tabbarColor = ThemeAssets.tabbarColor.swiftUIColor public private(set) static var primaryButtonTextColor = ThemeAssets.primaryButtonTextColor.swiftUIColor public private(set) static var toggleSwitchColor = ThemeAssets.toggleSwitchColor.swiftUIColor + public private(set) static var textInputTextColor = ThemeAssets.textInputTextColor.swiftUIColor + public private(set) static var textInputPlaceholderColor = ThemeAssets.textInputPlaceholderColor.swiftUIColor + public private(set) static var infoColor = ThemeAssets.infoColor.swiftUIColor + public private(set) static var irreversibleAlert = ThemeAssets.irreversibleAlert.swiftUIColor public static func update( accentColor: Color = ThemeAssets.accentColor.swiftUIColor, @@ -102,7 +106,11 @@ public struct Theme { success: Color = ThemeAssets.success.swiftUIColor, tabbarColor: Color = ThemeAssets.tabbarColor.swiftUIColor, primaryButtonTextColor: Color = ThemeAssets.primaryButtonTextColor.swiftUIColor, - toggleSwitchColor: Color = ThemeAssets.toggleSwitchColor.swiftUIColor + toggleSwitchColor: Color = ThemeAssets.toggleSwitchColor.swiftUIColor, + textInputTextColor: Color = ThemeAssets.textInputTextColor.swiftUIColor, + textInputPlaceholderColor: Color = ThemeAssets.textInputPlaceholderColor.swiftUIColor, + infoColor: Color = ThemeAssets.infoColor.swiftUIColor, + irreversibleAlert: Color = ThemeAssets.irreversibleAlert.swiftUIColor ) { self.accentColor = accentColor self.accentXColor = accentXColor @@ -145,6 +153,10 @@ public struct Theme { self.tabbarColor = tabbarColor self.primaryButtonTextColor = primaryButtonTextColor self.toggleSwitchColor = toggleSwitchColor + self.textInputTextColor = textInputTextColor + self.textInputPlaceholderColor = textInputPlaceholderColor + self.infoColor = infoColor + self.irreversibleAlert = irreversibleAlert } } @@ -251,6 +263,40 @@ public struct Theme { public static let snackbarMessageLongTimeout: TimeInterval = 5 } + public struct InputFieldBackground: View { + public let placeHolder: String + public let text: String + public let color: Color + public let padding: CGFloat + public let font: Font + + public init( + placeHolder: String, + text: String, + color: Color = Theme.Colors.textInputPlaceholderColor, + font: Font = Theme.Fonts.bodyLarge, + padding: CGFloat = 8 + ) { + self.placeHolder = placeHolder + self.color = color + self.text = text + self.padding = padding + self.font = font + } + + public var body: some View { + ZStack(alignment: .leading) { + Theme.Shapes.textInputShape + .fill(Theme.Colors.textInputBackground) + if text.count == 0 { + Text(placeHolder) + .foregroundColor(color) + .padding(.leading, padding) + .font(font) + } + } + } + } } public extension Theme.Fonts {