46 lines
1022 B
Swift
46 lines
1022 B
Swift
//
|
|
// TabButton.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/09.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TabButton: View {
|
|
|
|
let title: String
|
|
let action: () -> Void
|
|
let image: () -> String
|
|
let fontName: () -> String
|
|
let color: () -> Color
|
|
let width: CGFloat
|
|
|
|
var body: some View {
|
|
VStack(spacing: 3.3) {
|
|
Image(image())
|
|
|
|
Text(title)
|
|
.font(.custom(fontName(), size: 10))
|
|
.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" },
|
|
fontName: { Font.bold.rawValue },
|
|
color: { Color(hex: "3bb9f1") },
|
|
width: UIScreen.main.bounds.width / 4
|
|
)
|
|
}
|
|
}
|