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 { HStack(alignment: .top, spacing: SodaSpacing.s12) { 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) } } .padding(.leading, SodaSpacing.s20) } .frame(maxWidth: .infinity, alignment: .leading) Button(action: onTapAll) { Text(I18n.HomeFollowing.allButtonTitle) .appFont(.body5) .foregroundColor(Color.soda400) .frame(width: 70, height: 102, alignment: .center) } .buttonStyle(.plain) } } } 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) } }