56 lines
1.7 KiB
Swift
56 lines
1.7 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)
|
|
.font(
|
|
.custom(
|
|
selectedTheme == theme ? Font.preBold.rawValue : Font.preRegular.rawValue,
|
|
size: 16
|
|
)
|
|
)
|
|
.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("전체")
|
|
)
|
|
}
|