sodalive-ios/SodaLive/Sources/Content/Detail/ContentDetailOtherContentVi...

52 lines
1.7 KiB
Swift

//
// ContentDetailOtherContentView.swift
// SodaLive
//
// Created by klaus on 2023/08/13.
//
import SwiftUI
struct ContentDetailOtherContentView: View {
let title: String
let items: [OtherContentResponse]
let onClickItem: (Int) -> Void
var body: some View {
VStack(spacing: 21.3) {
Text(title)
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.frame(maxWidth: .infinity, alignment: .leading)
if items.count > 0 {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 13.3) {
ForEach(0..<items.count, id: \.self) { index in
let item = items[index]
ContentDetailAnotherItemView(item: item)
.onTapGesture { onClickItem(item.contentId) }
}
}
}
} else {
VStack(spacing: 6.7) {
Image("ic_no_item")
.resizable()
.frame(width: 60, height: 60)
Text("\(title)를 준비중입니다.\n조금만 기다려주세요.")
.multilineTextAlignment(.center)
.font(.custom(Font.medium.rawValue, size: 10.7))
.foregroundColor(Color(hex: "bbbbbb"))
}
.padding(13.3)
.frame(maxWidth: .infinity)
.background(Color(hex: "13181b"))
.cornerRadius(4.7)
}
}
}
}