홈 - 하단 탭 추가
This commit is contained in:
45
SodaLive/Sources/Main/Home/TabButton.swift
Normal file
45
SodaLive/Sources/Main/Home/TabButton.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// 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: "9970ff") },
|
||||
width: UIScreen.main.bounds.width / 4
|
||||
)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user