feat(main): 라이브 전체 진입을 추가한다
This commit is contained in:
@@ -3,6 +3,7 @@ import SwiftUI
|
||||
struct MainHomeLiveSection: View {
|
||||
let items: [HomeLiveItem]
|
||||
let onTapLive: (Int) -> Void
|
||||
let onTapAll: () -> Void
|
||||
|
||||
var body: some View {
|
||||
if !items.isEmpty {
|
||||
@@ -11,6 +12,8 @@ struct MainHomeLiveSection: View {
|
||||
ForEach(items, id: \.self) { item in
|
||||
MainHomeLiveItemView(item: item, onTapLive: onTapLive)
|
||||
}
|
||||
|
||||
MainHomeLiveAllItemView(onTapAll: onTapAll)
|
||||
}
|
||||
.padding(.horizontal, SodaSpacing.s20)
|
||||
}
|
||||
@@ -54,6 +57,27 @@ private struct MainHomeLiveItemView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private struct MainHomeLiveAllItemView: View {
|
||||
let onTapAll: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: onTapAll) {
|
||||
VStack(alignment: .center, spacing: SodaSpacing.s6) {
|
||||
Circle()
|
||||
.fill(Color.gray800)
|
||||
.frame(width: 70, height: 70)
|
||||
.overlay {
|
||||
Text(I18n.HomeRecommendation.liveAll)
|
||||
.appFont(.body4)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
.frame(width: 70, height: 102, alignment: .top)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeLiveSection_Previews: PreviewProvider {
|
||||
private static let previewImageUrl = "https://picsum.photos/500/500"
|
||||
|
||||
@@ -72,7 +96,8 @@ struct MainHomeLiveSection_Previews: PreviewProvider {
|
||||
HomeLiveItem(roomId: 1, creatorNickname: "설린", creatorProfileImage: previewImageUrl),
|
||||
HomeLiveItem(roomId: 2, creatorNickname: "크리에이터", creatorProfileImage: previewImageUrl)
|
||||
],
|
||||
onTapLive: { _ in }
|
||||
onTapLive: { _ in },
|
||||
onTapAll: {}
|
||||
)
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
|
||||
@@ -7,6 +7,7 @@ struct MainHomeRecommendationView: View {
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapBanner: (RecommendationBannerResponse) -> Void
|
||||
let onTapLiveAll: () -> Void
|
||||
let onTapFollowAll: (@escaping () -> Void) -> Void
|
||||
|
||||
@StateObject private var viewModel = MainHomeRecommendationViewModel()
|
||||
@@ -25,7 +26,8 @@ struct MainHomeRecommendationView: View {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s24) {
|
||||
MainHomeLiveSection(
|
||||
items: viewModel.recommendations?.lives ?? [],
|
||||
onTapLive: onTapLive
|
||||
onTapLive: onTapLive,
|
||||
onTapAll: onTapLiveAll
|
||||
)
|
||||
|
||||
MainHomeBannerSection(
|
||||
@@ -122,6 +124,7 @@ struct MainHomeRecommendationView_Previews: PreviewProvider {
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunityPost: { _ in },
|
||||
onTapBanner: { _ in },
|
||||
onTapLiveAll: {},
|
||||
onTapFollowAll: { action in action() }
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user