import SwiftUI enum KTheme { static let background = Color(red: 11/255, green: 11/255, blue: 14/255) static let panel = Color(red: 28/255, green: 28/255, blue: 34/255) static let orange = Color(red: 1, green: 106/255, blue: 0) static let pink = Color(red: 242/255, green: 29/255, blue: 167/255) static let purple = Color(red: 111/255, green: 60/255, blue: 1) } struct PanelModifier: ViewModifier { func body(content: Content) -> some View { content .padding(18) .background(KTheme.panel) .clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous)) } } extension View { func kasztelanPanel() -> some View { modifier(PanelModifier()) } } struct PrimaryButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .font(.headline) .foregroundStyle(.white) .frame(maxWidth: .infinity, minHeight: 54) .background(KTheme.pink.opacity(configuration.isPressed ? 0.72 : 1)) .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous)) } } struct KasztelanField: View { @EnvironmentObject private var model: AppModel let title: String @Binding var text: String var secure = false var keyboard: UIKeyboardType = .default var contentType: UITextContentType? @FocusState private var isFocused: Bool var body: some View { Group { if secure { SecureField(title, text: $text) } else { TextField(title, text: $text) .keyboardType(keyboard) } } .focused($isFocused) .textContentType(contentType) .textInputAutocapitalization(keyboard == .emailAddress ? .never : .sentences) .autocorrectionDisabled(keyboard == .emailAddress) .padding(.horizontal, 16) .frame(maxWidth: .infinity, minHeight: 54) .background(KTheme.panel) .clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous)) .foregroundStyle(.white) .toolbar { ToolbarItemGroup(placement: .keyboard) { Spacer() Button(model.text("Gotowe", "Done")) { isFocused = false } .fontWeight(.semibold) } } } }