feat(main): 메인 탭 화면을 추가한다
This commit is contained in:
45
SodaLive/Sources/V2/Main/MainTabBarButton.swift
Normal file
45
SodaLive/Sources/V2/Main/MainTabBarButton.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// MainTabBarButton.swift
|
||||
// SodaLive
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainTabBarButton: View {
|
||||
let tab: MainTab
|
||||
let isSelected: Bool
|
||||
let width: CGFloat
|
||||
let action: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
VStack(spacing: 4) {
|
||||
ZStack(alignment: .center) {
|
||||
Image(isSelected ? tab.selectedIconName : tab.unselectedIconName)
|
||||
}
|
||||
.frame(height: 24)
|
||||
|
||||
Text(tab.title)
|
||||
.appFont(.caption3)
|
||||
.foregroundColor(isSelected ? Color.white : Color.gray600)
|
||||
.frame(height: 12, alignment: .bottom)
|
||||
}
|
||||
.frame(width: width, alignment: .center)
|
||||
.frame(minHeight: 50)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainTabBarButton_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainTabBarButton(
|
||||
tab: .home,
|
||||
isSelected: true,
|
||||
width: UIScreen.main.bounds.width / 4,
|
||||
action: {}
|
||||
)
|
||||
.background(Color.black)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user