//
//  MessageFilterTabView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/10.
//

import SwiftUI

struct MessageFilterTabView: View {
    
    @Binding var currentFilterTab: MessageFilterTab
    
    var body: some View {
        HStack(spacing: 6.7) {
            Text("받은 메시지")
                .font(.custom(Font.medium.rawValue, size: 12))
                .foregroundColor(Color(hex: currentFilterTab == .receive ? "3bb9f1" : "777777"))
                .padding(.horizontal, 25)
                .padding(.vertical, 10.7)
                .overlay(
                    RoundedRectangle(cornerRadius: 16.7)
                        .stroke(
                            Color(hex: currentFilterTab == .receive ? "3bb9f1" : "777777"),
                            lineWidth: 1
                        )
                )
                .onTapGesture {
                    if currentFilterTab != .receive {
                        currentFilterTab = .receive
                    }
                }
            
            Text("보낸 메시지")
                .font(.custom(Font.medium.rawValue, size: 12))
                .foregroundColor(Color(hex: currentFilterTab == .sent ? "3bb9f1" : "777777"))
                .padding(.horizontal, 25)
                .padding(.vertical, 10.7)
                .overlay(
                    RoundedRectangle(cornerRadius: 16.7)
                        .stroke(
                            Color(hex: currentFilterTab == .sent ? "3bb9f1" : "777777"),
                            lineWidth: 1
                        )
                )
                .onTapGesture {
                    if currentFilterTab != .sent {
                        currentFilterTab = .sent
                    }
                }
            
            Text("보관함")
                .font(.custom(Font.medium.rawValue, size: 12))
                .foregroundColor(Color(hex: currentFilterTab == .keep ? "3bb9f1" : "777777"))
                .padding(.horizontal, 25)
                .padding(.vertical, 10.7)
                .overlay(
                    RoundedRectangle(cornerRadius: 16.7)
                        .stroke(
                            Color(hex: currentFilterTab == .keep ? "3bb9f1" : "777777"),
                            lineWidth: 1
                        )
                )
                .onTapGesture {
                    if currentFilterTab != .keep {
                        currentFilterTab = .keep
                    }
                }
        }
    }
}

struct MessageFilterTabView_Previews: PreviewProvider {
    static var previews: some View {
        MessageFilterTabView(currentFilterTab: .constant(.receive))
    }
}
