import SwiftUI

public struct RadioButton: View {
    public var isSelected: Bool

    public init(isSelected: Bool) {
        self.isSelected = isSelected
    }

    public var body: some View {
        ZStack {
            Image.Icon.radioButtonOutline
                .renderingMode(.template)
                .resizable()
                .frame(width: 24, height: 24)
                .foregroundColor(isSelected ? Color.SemanticV1.iconLink : Color.SemanticV1.foregroundInactive)

            if isSelected {
                Circle()
                    .fill(Color.SemanticV1.iconLink)
                    .padding(6)
                    .frame(width: 24, height: 24)
            }
        }
    }
}

struct RadioButton_Previews: PreviewProvider {
    static var previews: some View {
        VStack {
            RadioButton(isSelected: true)
            RadioButton(isSelected: false)
        }
        .padding()
    }
}
