feat(home): 팔로잉 크리에이터 섹션을 추가한다

This commit is contained in:
Yu Sung
2026-07-01 00:04:17 +09:00
parent ae09776c9b
commit fb7d0c799f
6 changed files with 114 additions and 6 deletions

View File

@@ -0,0 +1,68 @@
import SwiftUI
struct MainHomeFollowingCreatorSection: View {
let followingCreators: [FollowingCreatorResponse]
let onTapCreator: (Int) -> Void
let onTapAll: () -> Void
init(
followingCreators: [FollowingCreatorResponse],
onTapCreator: @escaping (Int) -> Void = { _ in },
onTapAll: @escaping () -> Void = {}
) {
self.followingCreators = followingCreators
self.onTapCreator = onTapCreator
self.onTapAll = onTapAll
}
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(alignment: .top, spacing: SodaSpacing.s12) {
ForEach(followingCreators) { creator in
CreatorProfileItem(
imageUrl: creator.creatorProfileImageUrl,
name: creator.creatorNickname,
imageSize: CGSize(width: 72, height: 72),
spacing: SodaSpacing.s8
) {
onTapCreator(creator.creatorId)
}
.frame(width: 72)
}
Button(action: onTapAll) {
Text(I18n.HomeFollowing.allButtonTitle)
.appFont(.body4)
.foregroundColor(Color.soda400)
.padding(.horizontal, 16)
.frame(height: allButtonHeight)
}
.buttonStyle(.plain)
}
.padding(.horizontal, SodaSpacing.s20)
}
}
private var allButtonHeight: CGFloat { 72 + SodaSpacing.s8 + 20 }
}
struct MainHomeFollowingCreatorSection_Previews: PreviewProvider {
static var previews: some View {
VStack(spacing: SodaSpacing.s20) {
MainHomeFollowingCreatorSection(
followingCreators: [
FollowingCreatorResponse(
creatorId: 1,
creatorNickname: "크리에이터",
creatorProfileImageUrl: "https://picsum.photos/200/200"
)
]
)
MainHomeFollowingCreatorSection(followingCreators: [])
}
.padding(.vertical, SodaSpacing.s20)
.background(Color.black)
.previewLayout(.sizeThatFits)
}
}

View File

@@ -1,8 +1,21 @@
import SwiftUI
struct MainHomeFollowingView: View {
let onTapFollowingAll: () -> Void
init(onTapFollowingAll: @escaping () -> Void = {}) {
self.onTapFollowingAll = onTapFollowingAll
}
var body: some View {
MainPlaceholderTabView(title: "팔로잉")
VStack(spacing: 0) {
MainHomeFollowingCreatorSection(
followingCreators: [],
onTapAll: onTapFollowingAll
)
MainPlaceholderTabView(title: "팔로잉")
}
}
}