탐색 - 크리에이터 랭킹 UI 추가

This commit is contained in:
Yu Sung
2023-10-14 18:34:10 +09:00
parent 6c8e19aed5
commit 41d5bad46f
6 changed files with 139 additions and 66 deletions

View File

@@ -7,7 +7,6 @@
import SwiftUI
import Kingfisher
import GoogleMobileAds
struct ExplorerView: View {
@@ -85,68 +84,7 @@ struct ExplorerView: View {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 26.7) {
ForEach(0..<viewModel.explorerSections.count, id: \.self) { index in
let section = viewModel.explorerSections[index]
VStack(alignment: .leading, spacing: 13.3) {
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"))
}
}
.frame(width: screenSize().width - 26.7, alignment: .leading)
} else {
Text(section.title)
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 26.7, alignment: .leading)
}
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 13.3) {
ForEach(section.creators, id: \.self) { creator in
VStack(spacing: 0) {
KFImage(URL(string: creator.profileImageUrl))
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: 93.3, height: 93.3))
.resizable()
.frame(width: 93.3, height: 93.3)
.clipShape(Circle())
Text(creator.nickname)
.font(.custom(Font.medium.rawValue, size: 11.3))
.foregroundColor(Color(hex: "eeeeee"))
.lineLimit(1)
.frame(width: 93.3)
.padding(.top, 13.3)
Text(creator.tags)
.font(.custom(Font.medium.rawValue, size: 10))
.foregroundColor(Color(hex: "9970ff"))
.lineLimit(1)
.frame(width: 93.3)
.padding(.top, 3.3)
}
.contentShape(Rectangle())
.onTapGesture {
AppState.shared
.setAppStep(step: .creatorDetail(userId: creator.id))
}
}
}
}
.frame(width: screenSize().width - 26.7, alignment: .leading)
}
ExplorerSectionView(section: viewModel.explorerSections[index])
}
}
.padding(.vertical, 40)