sodalive-ios/SodaLive/Sources/Content/Series/Detail/SeriesDetailHomeView.swift

110 lines
3.5 KiB
Swift

//
// SeriesDetailHomeView.swift
// SodaLive
//
// Created by klaus on 4/29/24.
//
import SwiftUI
struct SeriesDetailHomeView: View {
let title: String
let seriesId: Int
let contentCount: Int
let contentList: [GetSeriesContentListItem]
var body: some View {
VStack(spacing: 0) {
HStack(spacing: 0) {
Text("전체회차 듣기")
.font(.custom(Font.bold.rawValue, size: 16))
.foregroundColor(Color.button)
Text(" (\(contentCount))")
.font(.custom(Font.light.rawValue, size: 16))
.foregroundColor(Color.button)
}
.frame(maxWidth: .infinity)
.padding(.vertical, 13.3)
.background(Color.bg)
.cornerRadius(5.3)
.overlay(
RoundedRectangle(cornerRadius: 5.3)
.stroke()
.foregroundColor(Color.button)
)
.padding(.top, 16)
.onTapGesture {
AppState.shared
.setAppStep(step: .seriesContentAll(seriesId: seriesId, seriesTitle: title))
}
VStack(spacing: 8) {
ForEach(0..<contentList.count, id: \.self) {
let item = contentList[$0]
SeriesContentListItemView(item: item)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared
.setAppStep(step: .contentDetail(contentId: item.contentId))
}
}
}
.padding(.top, 16)
}
.padding(.horizontal, 13.3)
}
}
#Preview {
SeriesDetailHomeView(
title: "변호사 우영우",
seriesId: 0,
contentCount: 10,
contentList: [
GetSeriesContentListItem(
contentId: 1,
title: "[무료] 두근두근 연애 연구부 EP1",
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
releaseDate: "",
duration: "00:14:59",
price: 0,
isRented: false,
isOwned: false
),
GetSeriesContentListItem(
contentId: 2,
title: "두근두근 연애 연구부 EP2",
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
releaseDate: "",
duration: "00:14:59",
price: 100,
isRented: false,
isOwned: false
),
GetSeriesContentListItem(
contentId: 3,
title: "두근두근 연애 연구부 EP3",
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
releaseDate: "",
duration: "00:14:59",
price: 100,
isRented: true,
isOwned: false
),
GetSeriesContentListItem(
contentId: 4,
title: "두근두근 연애 연구부 EP4",
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
releaseDate: "",
duration: "00:14:59",
price: 100,
isRented: false,
isOwned: true
)
]
)
}