Files
sodalive-ios/SodaLive/Sources/Main/Home/TabButton.swift

46 lines
1.0 KiB
Swift

//
// TabButton.swift
// SodaLive
//
// Created by klaus on 2023/08/09.
//
import SwiftUI
struct TabButton: View {
let title: LocalizedStringResource
let action: () -> Void
let image: () -> String
let fontWeight: () -> SwiftUI.Font.Weight
let color: () -> Color
let width: CGFloat
var body: some View {
VStack(spacing: 3.3) {
Image(image())
Text(title)
.appFont(size: 10, weight: fontWeight())
.foregroundColor(color())
}
.frame(width: width)
.contentShape(Rectangle())
.padding(.vertical, 13.3)
.onTapGesture { action() }
}
}
struct TabButton_Previews: PreviewProvider {
static var previews: some View {
TabButton(
title: "라이브",
action: {},
image: { "ic_tabbar_live_selected" },
fontWeight: { .bold },
color: { Color(hex: "3bb9f1") },
width: UIScreen.main.bounds.width / 4
)
}
}