Files
Gas-Tank-AR-App/GasTankAR/Views/Leads/Overview/LeadSearchField.swift

36 lines
1.2 KiB
Swift

import SwiftUI
struct LeadSearchField: View {
@Binding var text: String
var isFocused: FocusState<Bool>.Binding
let onClear: () -> Void
var body: some View {
HStack(spacing: 12) {
Image(systemName: "magnifyingglass")
.accessibilityHidden(true)
TextField("Firma, Person, Ort oder LeadID", text: $text)
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
.submitLabel(.search)
.focused(isFocused)
.onSubmit { isFocused.wrappedValue = false }
.accessibilityLabel("Interessenten suchen")
if !text.isEmpty {
Button(action: onClear) {
Image(systemName: "xmark.circle.fill")
.frame(width: 44, height: 44)
.contentShape(.rect)
}
.buttonStyle(.plain)
.accessibilityLabel("Suche löschen")
.padding(.vertical, -10)
}
}
.font(.title3)
.foregroundStyle(.secondary)
.padding(18)
.background(Color.primary.opacity(0.06), in: .rect(cornerRadius: 15))
}
}