feat(home): 콘텐츠 소식 카드를 추가한다

This commit is contained in:
Yu Sung
2026-07-01 16:53:49 +09:00
parent e60942735b
commit 5b679389a6
4 changed files with 284 additions and 41 deletions

View File

@@ -67,7 +67,27 @@ struct MainHomeFollowingNewsSection: View {
)
}
case .audioContent, .photoContent, .unknown:
case .audioContent:
if let audioContent = news.audioContent {
MainHomeFollowingContentNewsCard(
content: audioContent,
visibleFromAtUtc: news.visibleFromAtUtc,
variant: .audio,
onTapContent: onTapContent
)
}
case .photoContent:
if let photoContent = news.photoContent {
MainHomeFollowingContentNewsCard(
content: photoContent,
visibleFromAtUtc: news.visibleFromAtUtc,
variant: .photo,
onTapContent: onTapContent
)
}
case .unknown:
EmptyView()
}
}
@@ -83,46 +103,80 @@ struct MainHomeFollowingNewsSection_Previews: PreviewProvider {
private static let previewImageUrl = "https://picsum.photos/500/500"
static var previews: some View {
MainHomeFollowingNewsSection(
recentNews: [
FollowingNewsResponse(
newsId: "creator-ranking",
type: .creatorRanking,
visibleFromAtUtc: "2026-07-01T00:00:00Z",
creatorRanking: FollowingCreatorRankingNewsResponse(
rank: 2,
creatorId: 1,
nickname: "크리에이터",
profileImageUrl: previewImageUrl
ScrollView(.vertical) {
MainHomeFollowingNewsSection(
recentNews: [
FollowingNewsResponse(
newsId: "creator-ranking",
type: .creatorRanking,
visibleFromAtUtc: "2026-07-01T00:00:00Z",
creatorRanking: FollowingCreatorRankingNewsResponse(
rank: 2,
creatorId: 1,
nickname: "크리에이터",
profileImageUrl: previewImageUrl
),
audioContent: nil,
photoContent: nil,
contentRanking: nil,
communityPost: nil
),
audioContent: nil,
photoContent: nil,
contentRanking: nil,
communityPost: nil
),
FollowingNewsResponse(
newsId: "community-post",
type: .communityPost,
visibleFromAtUtc: "2026-07-01T00:00:00Z",
creatorRanking: nil,
audioContent: nil,
photoContent: nil,
contentRanking: nil,
communityPost: FollowingCommunityPostNewsResponse(
postId: 10,
creatorProfileImage: previewImageUrl,
creatorNickname: "크리에이터",
imageUrl: previewImageUrl,
content: "팔로잉 크리에이터의 커뮤니티 게시글입니다.",
createdAt: "2026-07-01T00:00:00Z",
likeCount: 5,
commentCount: 2
FollowingNewsResponse(
newsId: "community-post",
type: .communityPost,
visibleFromAtUtc: "2026-07-01T00:00:00Z",
creatorRanking: nil,
audioContent: nil,
photoContent: nil,
contentRanking: nil,
communityPost: FollowingCommunityPostNewsResponse(
postId: 10,
creatorProfileImage: previewImageUrl,
creatorNickname: "크리에이터",
imageUrl: previewImageUrl,
content: "팔로잉 크리에이터의 커뮤니티 게시글입니다.",
createdAt: "2026-07-01T00:00:00Z",
likeCount: 5,
commentCount: 2
)
),
FollowingNewsResponse(
newsId: "audio-content",
type: .audioContent,
visibleFromAtUtc: "2026-07-01T00:02:00Z",
creatorRanking: nil,
audioContent: FollowingContentNewsResponse(
contentId: 20,
contentImageUrl: previewImageUrl,
title: "오디오 콘텐츠 이름",
creatorProfileImageUrl: previewImageUrl,
creatorNickname: "크리에이터이름"
),
photoContent: nil,
contentRanking: nil,
communityPost: nil
),
FollowingNewsResponse(
newsId: "photo-content",
type: .photoContent,
visibleFromAtUtc: "2026-07-01T00:03:00Z",
creatorRanking: nil,
audioContent: nil,
photoContent: FollowingContentNewsResponse(
contentId: 21,
contentImageUrl: previewImageUrl,
title: "화보 콘텐츠 이름",
creatorProfileImageUrl: previewImageUrl,
creatorNickname: "크리에이터이름"
),
contentRanking: nil,
communityPost: nil
)
)
]
)
.padding(.vertical, SodaSpacing.s20)
.background(Color.black)
.previewLayout(.sizeThatFits)
]
)
.padding(.vertical, SodaSpacing.s20)
.background(Color.black)
.previewLayout(.sizeThatFits)
}
}
}