sodalive-ios/SodaLive/Sources/Content/Main/V2/ContentMainNewContentViewV2...

98 lines
3.1 KiB
Swift

//
// ContentMainNewContentViewV2.swift
// SodaLive
//
// Created by klaus on 2/21/25.
//
import SwiftUI
struct ContentMainNewContentViewV2: View {
let title: String
let onClickMore: () -> Void
let themeList: [String]
let contentList: [GetAudioContentMainItem]
let selectTheme: (String) -> Void
@State private var selectedTheme = "전체"
var body: some View {
LazyVStack(spacing: 13.3) {
HStack(spacing: 0) {
Text(title)
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
Image("ic_forward")
.resizable()
.frame(width: 20, height: 20)
.onTapGesture {
}
}
.padding(.horizontal, 13.3)
ContentMainContentThemeView(
themeList: themeList,
selectTheme: selectTheme,
selectedTheme: $selectedTheme
)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 13.3) {
ForEach(0..<contentList.count, id: \.self) { index in
ContentMainItemView(item: contentList[index])
}
}
.padding(.horizontal, 13.3)
}
}
.onAppear {
selectedTheme = themeList[0]
}
}
}
#Preview {
ContentMainNewContentViewV2(
title: "새로운 단편",
onClickMore: {},
themeList: ["전체", "테스트1", "테스트2"],
contentList: [
GetAudioContentMainItem(
contentId: 1,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "ㅓ처랴햐햫햐햐",
creatorId: 8,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저1",
price: 10,
duration: "00:00:30"
),
GetAudioContentMainItem(
contentId: 2,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "ㅓ처랴햐햫햐햐",
creatorId: 8,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저2",
price: 10,
duration: "00:00:30"
),
GetAudioContentMainItem(
contentId: 3,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "ㅓ처랴햐햫햐햐",
creatorId: 8,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저3",
price: 10,
duration: "00:00:30"
)
],
selectTheme: { _ in }
)
}