//
//  IconAndTitleToggleButton.swift
//  SodaLive
//
//  Created by klaus on 2023/12/15.
//

import SwiftUI

struct IconAndTitleToggleButton: View {
    
    let isChecked: Bool
    let title: String
    let normalIconName: String
    let checkedIconName: String
    
    let onClick: () -> Void
    
    var body: some View {
        HStack(spacing: 4) {
            Image(isChecked ? checkedIconName : normalIconName)
            
            Text("\(title)")
                .font(.custom(Font.medium.rawValue, size: 13.3))
                .foregroundColor(Color(hex: "d2d2d2"))
        }
        .padding(.horizontal, 13.3)
        .padding(.vertical, 5.3)
        .background(Color(hex: "ffffff").opacity(0.1))
        .cornerRadius(26.7)
        .onTapGesture { onClick() }
    }
}

struct IconAndTitleToggleButton_Previews: PreviewProvider {
    static var previews: some View {
        IconAndTitleToggleButton(
            isChecked: true,
            title: "100",
            normalIconName: "ic_audio_content_heart_normal",
            checkedIconName: "ic_audio_content_heart_pressed"
        ) {}
    }
}
