//
//  BarButtonView.swift
//  PadelClub
//
//  Created by Razmig Sarkissian on 24/04/2024.
//

import SwiftUI

struct BarButtonView: View {
    let accessibilityLabel: String
    let icon: String
    let action: () -> ()
    
    init(_ accessibilityLabel: String, icon: String, action: @escaping () -> Void) {
        self.accessibilityLabel = accessibilityLabel
        self.icon = icon
        self.action = action
    }
    
    var body: some View {
        Button(action: {
            action()
        }) {
            Image(systemName: icon)
                .resizable()
                .scaledToFit()
                .frame(minHeight: 28)
            
            /*
             Label {
                 Text(accessibilityLabel)
             } icon: {
                 Image(systemName: icon)
                     .resizable()
                     .scaledToFit()
                     .frame(minHeight: 36)
             }
             .labelStyle(.iconOnly)
             //todo: resizing not working when label used
             */
        }
    }
}
