// // ExplorerSectionView.swift // SodaLive // // Created by klaus on 2023/10/14. // import SwiftUI import Kingfisher struct ExplorerSectionView: View { let section: GetExplorerSectionResponse let rankingCrawns = ["ic_crown_1", "ic_crown_2", "ic_crown_3"] let rankingColors = [ [Color(hex: "ffdc00"), Color(hex: "ffb600")], [Color(hex: "ffffff"), Color(hex: "9f9f9f")], [Color(hex: "e6a77a"), Color(hex: "c67e4a")], [Color(hex: "ffffff").opacity(0), Color(hex: "ffffff").opacity(0)] ] var body: some View { VStack(alignment: .leading, spacing: 13.3) { VStack(alignment: .leading, spacing: 4) { if let coloredTitle = section.coloredTitle, let color = section.color { let titleArray = section.title.components(separatedBy: coloredTitle) HStack(spacing: 0) { Text(titleArray[0]) .font(.custom(Font.bold.rawValue, size: 18.3)) .foregroundColor(Color(hex: "eeeeee")) Text(coloredTitle) .font(.custom(Font.bold.rawValue, size: 18.3)) .foregroundColor(Color(hex: color)) if titleArray.count > 1 { Text(titleArray[1]) .font(.custom(Font.bold.rawValue, size: 18.3)) .foregroundColor(Color(hex: "eeeeee")) } } } else { Text(section.title) .font(.custom(Font.bold.rawValue, size: 18.3)) .foregroundColor(Color(hex: "eeeeee")) } if let desc = section.desc { VStack(spacing: 8) { Text("\(desc)") .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color(hex: "eeeeee")) Text("※ 인기 크리에이터의 순위는 매주 업데이트됩니다.") .font(.custom(Font.light.rawValue, size: 13.3)) .foregroundColor(Color(hex: "bbbbbb")) } .padding(.vertical, 8) .frame(width: screenSize().width - 26.7) .background(Color(hex: "222222")) .padding(.top, 13.3) } } .frame(width: screenSize().width - 26.7, alignment: .leading) ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 13.3) { ForEach(0..