Files
sodalive-ios/SodaLive/Sources/Content/All/ByTheme/ContentAllByThemeView.swift
Yu Sung 280e424385 커스텀 폰트 pretendard-medium, gmarket-medium를 사용하고 있던 것을 appFont 모디
파이어를 사용하여 한국어는 pretendard, 그 외에는 시스템 폰트를 사용하도록 수정
2026-01-23 03:09:20 +09:00

121 lines
4.9 KiB
Swift

//
// ContentAllByThemeView.swift
// SodaLive
//
// Created by klaus on 2/14/24.
//
import SwiftUI
struct ContentAllByThemeView: View {
@StateObject var viewModel = ContentAllByThemeViewModel()
let themeId: Int
var body: some View {
NavigationView {
BaseView(isLoading: $viewModel.isLoading) {
VStack(alignment: .leading, spacing: 0) {
DetailNavigationBar(title: viewModel.theme)
HStack(spacing: 13.3) {
Spacer()
Text("최신순")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(
Color(hex: "e2e2e2")
.opacity(viewModel.sort == .NEWEST ? 1 : 0.5)
)
.onTapGesture {
if viewModel.sort != .NEWEST {
viewModel.sort = .NEWEST
}
}
Text("높은 가격순")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(
Color(hex: "e2e2e2")
.opacity(viewModel.sort == .PRICE_HIGH ? 1 : 0.5)
)
.onTapGesture {
if viewModel.sort != .PRICE_HIGH {
viewModel.sort = .PRICE_HIGH
}
}
Text("낮은 가격순")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(
Color(hex: "e2e2e2")
.opacity(viewModel.sort == .PRICE_LOW ? 1 : 0.5)
)
.onTapGesture {
if viewModel.sort != .PRICE_LOW {
viewModel.sort = .PRICE_LOW
}
}
}
.padding(.vertical, 13.3)
.padding(.horizontal, 20)
.background(Color(hex: "161616"))
.padding(.top, 13.3)
HStack(spacing: 0) {
Text("전체")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(Color(hex: "e2e2e2"))
Text("\(viewModel.totalCount)")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(Color(hex: "ff5c49"))
.padding(.leading, 8)
Text("")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(Color(hex: "e2e2e2"))
.padding(.leading, 2)
Spacer()
}
.padding(.vertical, 13.3)
.padding(.horizontal, 20)
let horizontalPadding: CGFloat = 16
let gridSpacing: CGFloat = 16
let itemSize = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
ScrollView(.vertical, showsIndicators: false) {
LazyVGrid(
columns: Array(
repeating: GridItem(
.flexible(),
spacing: gridSpacing,
alignment: .topLeading
),
count: 2
),
alignment: .leading,
spacing: gridSpacing
) {
ForEach(0..<viewModel.contentList.count, id: \.self) { index in
ContentNewAllItemView(width: itemSize, item: viewModel.contentList[index])
.onAppear {
if index == viewModel.contentList.count - 1 {
viewModel.getContentList()
}
}
}
}
}
}
.onAppear {
viewModel.themeId = themeId
viewModel.getContentList()
}
}
}
}
}