refactor: add color assets and update UI components
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LoginView: View {
|
||||
@EnvironmentObject var authViewModel: AuthViewModel
|
||||
@Environment(AuthViewModel.self) private var authViewModel
|
||||
@State private var email = ""
|
||||
@State private var password = ""
|
||||
@State private var showRegister = false
|
||||
@@ -23,7 +23,7 @@ struct LoginView: View {
|
||||
.scaledToFit()
|
||||
.frame(width: 84, height: 84)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
||||
.shadow(color: .red.opacity(0.25), radius: 12, y: 6)
|
||||
.shadow(color: .brand.opacity(0.25), radius: 12, y: 6)
|
||||
|
||||
Text("Mayday")
|
||||
.font(.largeTitle.bold())
|
||||
@@ -56,7 +56,7 @@ struct LoginView: View {
|
||||
|
||||
if let error = authViewModel.error {
|
||||
Text(error)
|
||||
.foregroundStyle(.red)
|
||||
.foregroundStyle(.brand)
|
||||
.font(.footnote)
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -69,7 +69,7 @@ struct LoginView: View {
|
||||
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
||||
.fill(
|
||||
LinearGradient(
|
||||
colors: [Color.red, Color.red.opacity(0.82)],
|
||||
colors: [Color.brand, Color.brand.opacity(0.82)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
@@ -107,3 +107,8 @@ struct LoginView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
LoginView()
|
||||
.environment(AuthViewModel())
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SwiftUI
|
||||
|
||||
struct RegisterView: View {
|
||||
@EnvironmentObject var authViewModel: AuthViewModel
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@Environment(AuthViewModel.self) private var authViewModel
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@State private var email = ""
|
||||
@State private var password = ""
|
||||
@@ -26,7 +26,7 @@ struct RegisterView: View {
|
||||
.scaledToFit()
|
||||
.frame(width: 76, height: 76)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
||||
.shadow(color: .red.opacity(0.22), radius: 12, y: 6)
|
||||
.shadow(color: .brand.opacity(0.22), radius: 12, y: 6)
|
||||
|
||||
Text("register_title")
|
||||
.font(.largeTitle.bold())
|
||||
@@ -48,21 +48,21 @@ struct RegisterView: View {
|
||||
|
||||
if password.count > 0 && password.count < 8 {
|
||||
Text("password_min_length")
|
||||
.foregroundStyle(.red)
|
||||
.foregroundStyle(.brand)
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if confirmPassword.count > 0 && password != confirmPassword {
|
||||
Text("passwords_mismatch")
|
||||
.foregroundStyle(.red)
|
||||
.foregroundStyle(.brand)
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if let error = authViewModel.error {
|
||||
Text(error)
|
||||
.foregroundStyle(.red)
|
||||
.foregroundStyle(.brand)
|
||||
.font(.footnote)
|
||||
.multilineTextAlignment(.leading)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -81,7 +81,7 @@ struct RegisterView: View {
|
||||
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
||||
.fill(
|
||||
LinearGradient(
|
||||
colors: [Color.red, Color.red.opacity(0.82)],
|
||||
colors: [Color.brand, Color.brand.opacity(0.82)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
@@ -122,3 +122,10 @@ struct RegisterView: View {
|
||||
!email.isEmpty && password.count >= 8 && password == confirmPassword
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
RegisterView()
|
||||
}
|
||||
.environment(AuthViewModel())
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ struct VerifyEmailView: View {
|
||||
let email: String
|
||||
let password: String
|
||||
|
||||
@EnvironmentObject var authViewModel: AuthViewModel
|
||||
@Environment(AuthViewModel.self) private var authViewModel
|
||||
@State private var codeDigits: [String] = Array(repeating: "", count: 6)
|
||||
@State private var resendCooldown = 0
|
||||
@State private var focusedIndex: Int?
|
||||
@@ -40,7 +40,7 @@ struct VerifyEmailView: View {
|
||||
|
||||
if let error = authViewModel.error {
|
||||
Text(error)
|
||||
.foregroundStyle(.red)
|
||||
.foregroundStyle(.brand)
|
||||
.font(.footnote)
|
||||
.multilineTextAlignment(.leading)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -65,7 +65,7 @@ struct VerifyEmailView: View {
|
||||
.scaledToFit()
|
||||
.frame(width: 72, height: 72)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||||
.shadow(color: .red.opacity(0.22), radius: 12, y: 6)
|
||||
.shadow(color: .brand.opacity(0.22), radius: 12, y: 6)
|
||||
|
||||
Text("verify_email_title")
|
||||
.font(.largeTitle.bold())
|
||||
@@ -102,7 +102,7 @@ struct VerifyEmailView: View {
|
||||
}
|
||||
}
|
||||
.font(.footnote.weight(.semibold))
|
||||
.foregroundStyle(resendCooldown > 0 ? Color.secondary : Color.red)
|
||||
.foregroundStyle(resendCooldown > 0 ? Color.secondary : Color.brand)
|
||||
.padding(.horizontal, 14)
|
||||
.padding(.vertical, 8)
|
||||
.background(Color(.tertiarySystemFill))
|
||||
@@ -136,7 +136,7 @@ struct VerifyEmailView: View {
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.stroke(
|
||||
focusedIndex == index
|
||||
? Color.red.opacity(0.9)
|
||||
? Color.brand.opacity(0.9)
|
||||
: Color.primary.opacity(0.10),
|
||||
lineWidth: focusedIndex == index ? 2 : 1
|
||||
)
|
||||
@@ -188,3 +188,10 @@ struct VerifyEmailView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
VerifyEmailView(email: "user@example.com", password: "password123")
|
||||
}
|
||||
.environment(AuthViewModel())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user