import ComponentLibrary
import SwiftUI

public struct MadlibsAuraButton: View {
    let title: String
    let isLoading: Bool
    let action: () -> Void

    @Environment(\.isEnabled) private var isEnabled

    public init(
        title: String,
        isLoading: Bool = false,
        action: @escaping () -> Void
    ) {
        self.title = title
        self.isLoading = isLoading
        self.action = action
    }

    public var body: some View {
        AuraButton(
            title: title,
            isLoading: isLoading,
            auraStyle: .orangeAura,
            withGradientOverlay: false,
            action: action
        )
        .contentTransition(.identity)
        .opacity((isEnabled && !isLoading) ? 1.0 : 0.4)
    }
}
