//
//  SeriesDetailTabView.swift
//  SodaLive
//
//  Created by klaus on 4/30/24.
//

import SwiftUI

struct SeriesDetailTabView: View {
    
    let title: String
    let width: CGFloat
    let isSelected: Bool
    let onClick: () -> Void
    
    var body: some View {
        VStack(spacing: 0) {
            Text(title)
                .font(.custom(isSelected ? Font.bold.rawValue : Font.medium.rawValue, size: 16.7))
                .foregroundColor(isSelected ? Color.button : Color.gray77)
                .frame(width: width, height: 50)
            
            if isSelected {
                Rectangle()
                    .foregroundColor(Color.button)
                    .frame(width: width, height: 3)
            }
        }
        .contentShape(Rectangle())
        .onTapGesture { onClick() }
    }
}

#Preview {
    SeriesDetailTabView(
        title: "홈",
        width: 180,
        isSelected: true,
        onClick: {}
    )
}