// // ContentMainNewContentThemeView.swift // SodaLive // // Created by klaus on 2023/08/11. // import SwiftUI struct ContentMainNewContentThemeView: View { let themes: [String] let selectTheme: (String) -> Void @Binding var selectedTheme: String var body: some View { ScrollView(.horizontal, showsIndicators: false) { HStack(alignment: .top, spacing: 8) { ForEach(0..<themes.count, id: \.self) { index in let theme = themes[index] Text(theme) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color(hex: selectedTheme == theme ? "9970ff" : "777777")) .padding(.horizontal, 13.3) .padding(.vertical, 9.3) .border( Color(hex: selectedTheme == theme ? "9970ff" : "eeeeee"), width: 0.5 ) .cornerRadius(16.7) .overlay( RoundedRectangle(cornerRadius: CGFloat(16.7)) .stroke(lineWidth: 0.5) .foregroundColor(Color(hex: selectedTheme == theme ? "9970ff" : "eeeeee")) ) .onTapGesture { selectTheme(theme) } } } } } } struct ContentMainNewContentThemeView_Previews: PreviewProvider { static var previews: some View { ContentMainNewContentThemeView( themes: ["전체", "테마1", "테마2"], selectTheme: { _ in }, selectedTheme: .constant("전체") ) } }