import SwiftUI

struct SharedHeader: View {
    var title: String

    var leftButton: (icon: String, action: () -> Void)?
    var rightButton: (icon: String, action: () -> Void)?

    var body: some View {
        ZStack {
            HStack {
                Spacer()
                Text(title)
                    .font(.head2)
                    .foregroundColor(.Main.black)
                Spacer()
            }
            HStack {
                if let leftButton {
                    Button {
                        leftButton.action()
                    } label: {
                        Image.init(systemName: leftButton.icon)
                            .foregroundColor(.Main.black)
                            .font(.system(size: 24, weight: .light))
                    }
                }
                Spacer()
            }
                .padding(.horizontal, 16)
        }
            .frame(height: 32)
            .background(Color.Main.backgroundLight)
    }
}
