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

import SwiftUI

struct PrestationSearchView: View {
    @State var text = ""

    var body: some View {
        VStack(spacing: 32) {
            // MARK: - Header
            VStack {
                HStack {
                    SQIcon(.chevron_left, size: .l)
                        .padding(.horizontal, 8)
                    SQSearchBar(text: $text, placeholder: "Rechercher")
                }

                HStack {
                    Spacer()
                        .frame(width: 38)
                    SQAddressModifyLine()
                }
            }

            // MARK: - List
            ScrollView {
                LazyVStack(alignment: .leading, spacing: 16) {

                    AllCategoriesCell()
                    Divider()

                    VStack(alignment: .leading, spacing: 16) {
                        SQText("Mes dernières recherches")
                            .sqSize(18)
                            .sqFont(.bold)
                        ForEach(0..<3) { _ in
                            PrestationHistorySearchCell()
                        }
                    }

                    VStack(alignment: .leading, spacing: 16) {
                        SQText("Recherches les plus populaires")
                            .sqSize(18)
                            .sqFont(.bold)
                        ForEach(0..<3) { _ in
                            PrestationCell()
                        }
                    }

                    ForEach(0..<10) { _ in
                        LazyVStack(alignment: .leading, spacing: 0) {
                            PrestationCell()
                        }
                    }

                }
                .padding(.vertical)
            }
        }
        .padding()
    }
}

#Preview {
    PrestationSearchView()
}
