import ComponentLibrary
import SwiftUI

public struct ButtonView: View {
    let image: Image
    let padding: CGFloat
    let color: Color
    let action: () -> Void

    public init(image: Image, padding: CGFloat = 8, color: Color = Color.SemanticV1.iconPrimary, action: @escaping () -> Void) {
        self.image = image
        self.padding = padding
        self.color = color
        self.action = action
    }

    public var body: some View {
        Button(action: action) {
            image
                .resizable()
                .scaledToFit()
                .padding(padding)
                .foregroundStyle(color)
                .frame(width: 32, height: 32, alignment: .center)
        }
        .buttonStyle(.plain)
    }
}
