Files
sodalive-ios/SodaLive/Sources/Content/Main/V2/ContentMainContentThemeView.swift

51 lines
1.5 KiB
Swift

//
// ContentMainContentThemeView.swift
// SodaLive
//
// Created by klaus on 2/21/25.
//
import SwiftUI
struct ContentMainContentThemeView: View {
let themeList: [String]
let selectTheme: (String) -> Void
@Binding var selectedTheme: String
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .top, spacing: 16) {
ForEach(0..<themeList.count, id: \.self) { index in
let theme = themeList[index]
Text(theme)
.appFont(size: 16, weight: selectedTheme == theme ? .bold : .regular)
.foregroundColor(.white)
.padding(.horizontal, 24)
.padding(.vertical, 12)
.background(
selectedTheme == theme ? Color.button : Color(hex: "263238")
)
.cornerRadius(999)
.onTapGesture {
if selectedTheme != theme {
selectedTheme = theme
selectTheme(theme)
}
}
}
}
.padding(.horizontal, 24)
}
}
}
#Preview {
ContentMainContentThemeView(
themeList: ["전체", "test", "test2"],
selectTheme: { _ in },
selectedTheme: .constant("전체")
)
}