56 lines
1.8 KiB
Swift
56 lines
1.8 KiB
Swift
//
|
|
// 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(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 {
|
|
if selectedTheme != theme {
|
|
selectTheme(theme)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct ContentMainNewContentThemeView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ContentMainNewContentThemeView(
|
|
themes: ["전체", "테마1", "테마2"],
|
|
selectTheme: { _ in },
|
|
selectedTheme: .constant("전체")
|
|
)
|
|
}
|
|
}
|