feat(content): 추천 오디오 탭을 추가한다
This commit is contained in:
@@ -8,6 +8,10 @@ struct CreatorChannelAudioSection: View {
|
||||
private let homeVisibleCount = 9
|
||||
private let itemsPerColumn = 3
|
||||
|
||||
private var rowWidth: CGFloat {
|
||||
AudioContentListRowStyle.compactWidth()
|
||||
}
|
||||
|
||||
init(
|
||||
audioContents: [CreatorChannelAudioContentResponse],
|
||||
onSelectTab: @escaping (CreatorChannelTab) -> Void,
|
||||
@@ -30,7 +34,13 @@ struct CreatorChannelAudioSection: View {
|
||||
ForEach(audioContentColumns.indices, id: \.self) { index in
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
|
||||
ForEach(audioContentColumns[index]) { audioContent in
|
||||
CreatorChannelHomeAudioContentListItem(audioContent: audioContent) {
|
||||
AudioContentListRow(
|
||||
item: AudioContentListRowItem(
|
||||
audioContent: audioContent,
|
||||
subtitle: subtitle(for: audioContent)
|
||||
),
|
||||
style: .compact(width: rowWidth)
|
||||
) {
|
||||
onTapContent(audioContent.audioContentId)
|
||||
}
|
||||
}
|
||||
@@ -54,6 +64,17 @@ struct CreatorChannelAudioSection: View {
|
||||
Array(visibleAudioContents[index..<min(index + itemsPerColumn, visibleAudioContents.count)])
|
||||
}
|
||||
}
|
||||
|
||||
private func subtitle(for audioContent: CreatorChannelAudioContentResponse) -> String? {
|
||||
let subtitle = [audioContent.duration, audioContent.seriesName]
|
||||
.compactMap { value in
|
||||
guard let value, !value.isEmpty else { return nil }
|
||||
return value
|
||||
}
|
||||
.joined(separator: " • ")
|
||||
|
||||
return subtitle.isEmpty ? nil : subtitle
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelAudioSection_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user