feat: 메인 홈
- 라이브, 인기 크리, 최신 콘텐츠, 이벤트 배너 UI 추가
This commit is contained in:
86
SodaLive/Sources/Home/HomeLatestContentView.swift
Normal file
86
SodaLive/Sources/Home/HomeLatestContentView.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// HomeLatestContentView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 7/11/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HomeLatestContentView: View {
|
||||
|
||||
let onClickMore: () -> Void
|
||||
let themeList: [String]
|
||||
let contentList: [AudioContentMainItem]
|
||||
|
||||
let selectTheme: (String) -> Void
|
||||
@State private var selectedTheme = "전체"
|
||||
|
||||
let rows = [
|
||||
GridItem(.flexible(), alignment: .leading),
|
||||
GridItem(.flexible(), alignment: .leading)
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Text("최신")
|
||||
.font(.custom(Font.preBold.rawValue, size: 26))
|
||||
.foregroundColor(.button)
|
||||
|
||||
Text(" 콘텐츠")
|
||||
.font(.custom(Font.preBold.rawValue, size: 26))
|
||||
.foregroundColor(.white)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("전체보기")
|
||||
.font(.custom(Font.preRegular.rawValue, size: 14))
|
||||
.foregroundColor(.init(hex: "78909C"))
|
||||
.onTapGesture { onClickMore() }
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
|
||||
if !themeList.isEmpty {
|
||||
ContentMainContentThemeView(
|
||||
themeList: themeList,
|
||||
selectTheme: selectTheme,
|
||||
selectedTheme: $selectedTheme
|
||||
)
|
||||
}
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHGrid(rows: rows, spacing: 16) {
|
||||
ForEach(0..<contentList.count, id: \.self) { index in
|
||||
ContentItemView(item: contentList[index])
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
HomeLatestContentView(
|
||||
onClickMore: {},
|
||||
themeList: ["전체", "테스트1", "테스트2"],
|
||||
contentList: [
|
||||
AudioContentMainItem(
|
||||
contentId: 1,
|
||||
creatorId: 3,
|
||||
title: "ㅓ처랴햐햫햐햐",
|
||||
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
creatorNickname: "유저1",
|
||||
isPointAvailable: true
|
||||
),
|
||||
AudioContentMainItem(
|
||||
contentId: 2,
|
||||
creatorId: 8,
|
||||
title: "ㅓ처랴햐햫햐햐",
|
||||
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
creatorNickname: "유저2",
|
||||
isPointAvailable: false
|
||||
)
|
||||
],
|
||||
selectTheme: { _ in }
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user