// // 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) } }