//
//  FAQRow.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 22/01/2025.
//

import SwiftUI

struct FAQRow: View {
    let item: FAQItem
    @State private var isExpanded = false

    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Button(action: {
                withAnimation {
                    isExpanded.toggle()
                }
            }) {
                HStack {
                    SQText(item.question)
                        .sqSize(13)
                        .sqFont(.semiBold)
                    Spacer()
                    SQIcon(isExpanded ? .chevron_up : .chevron_down)
                }
                .padding(.vertical, 16)
            }

            if isExpanded {
                SQText(item.answer)
                    .sqSize(14)
                    .padding(.bottom, 16)
            }

            Divider()
        }
    }
}
