refactor: add color assets and update UI components
This commit is contained in:
@@ -4,7 +4,7 @@ struct AppBackgroundModifier: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content.background(
|
||||
LinearGradient(
|
||||
colors: [Color(.systemGroupedBackground), Color.red.opacity(0.08)],
|
||||
colors: [Color(.systemGroupedBackground), Color.brand.opacity(0.08)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import SwiftUI
|
||||
|
||||
extension Color {
|
||||
static let brand = Color("Brand")
|
||||
static let success = Color("Success")
|
||||
static let warning = Color("Warning")
|
||||
static let info = Color("Info")
|
||||
}
|
||||
|
||||
extension ShapeStyle where Self == Color {
|
||||
static var brand: Color { .brand }
|
||||
static var success: Color { .success }
|
||||
static var warning: Color { .warning }
|
||||
static var info: Color { .info }
|
||||
}
|
||||
@@ -23,3 +23,8 @@ struct AppSecureField: View {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AppSecureField(title: "Password", icon: "lock.fill", text: .constant(""))
|
||||
.padding()
|
||||
}
|
||||
|
||||
@@ -23,3 +23,8 @@ struct AppTextField: View {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AppTextField(title: "Email", icon: "envelope.fill", text: .constant("user@example.com"))
|
||||
.padding()
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ enum NotificationSeverity: String {
|
||||
|
||||
var color: Color {
|
||||
switch self {
|
||||
case .critical: return .red
|
||||
case .warning: return .orange
|
||||
case .info: return .blue
|
||||
case .success: return .green
|
||||
case .critical: return .brand
|
||||
case .warning: return .warning
|
||||
case .info: return .info
|
||||
case .success: return .success
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,3 +45,13 @@ struct NotificationIconView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
HStack(spacing: 16) {
|
||||
NotificationIconView(severity: .critical, isActive: true)
|
||||
NotificationIconView(severity: .warning, isActive: false)
|
||||
NotificationIconView(severity: .info, isActive: false)
|
||||
NotificationIconView(severity: .success, isActive: false)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user