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) } }