//
//  SQSearchBar.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 06/01/2025.
//

import SwiftUI

struct SQSearchBar: View {
    @Binding var text: String
    var placeholder: String

    var body: some View {
        HStack(spacing: 16) {
            SQIcon(.magnifying_glass, type: .solid)
            TextField("", text: $text)
                .placeholder(when: text.isEmpty) {
                    SQText(placeholder)
                        .sqColor(.sqNeutral(50))
                }
                .tint(Color.sqNeutral(100))
        }
        .padding()
        .background(Color.sqNeutral(10))
        .cornerRadius(8)
    }
}

#Preview {
    SQSearchBar(text: .constant(""), placeholder: "Rechercher")
}
