feat(creator): 라이브 탭 기반을 추가한다
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorChannelSortBar: View {
|
||||
let totalCount: Int
|
||||
let selectedSort: ContentSort
|
||||
let onTapSort: () -> Void
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center, spacing: SodaSpacing.s8) {
|
||||
HStack(spacing: SodaSpacing.s4) {
|
||||
Text(I18n.CreatorChannelLive.totalLabel)
|
||||
.appFont(size: 14, weight: .medium)
|
||||
.foregroundColor(Color.gray500)
|
||||
|
||||
Text(totalCount.comma())
|
||||
.appFont(size: 14, weight: .medium)
|
||||
.foregroundColor(Color.gray400)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: onTapSort) {
|
||||
HStack(spacing: SodaSpacing.s4) {
|
||||
Text(selectedSort.title)
|
||||
.appFont(size: 14, weight: .medium)
|
||||
.foregroundColor(Color.white)
|
||||
|
||||
Image(systemName: "chevron.down")
|
||||
.font(.system(size: 12, weight: .semibold))
|
||||
.foregroundColor(Color.gray400)
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
.padding(.horizontal, SodaSpacing.s20)
|
||||
.frame(height: 52)
|
||||
.background(Color.black)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelSortBar_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorChannelSortBar(totalCount: 100, selectedSort: .latest, onTapSort: {})
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorChannelSortBottomSheet: View {
|
||||
let selectedSort: ContentSort
|
||||
let sorts: [ContentSort]
|
||||
let onSelect: (ContentSort) -> Void
|
||||
|
||||
init(
|
||||
selectedSort: ContentSort,
|
||||
sorts: [ContentSort] = ContentSort.allCases,
|
||||
onSelect: @escaping (ContentSort) -> Void
|
||||
) {
|
||||
self.selectedSort = selectedSort
|
||||
self.sorts = sorts
|
||||
self.onSelect = onSelect
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
ForEach(sorts, id: \.self) { sort in
|
||||
Button {
|
||||
onSelect(sort)
|
||||
} label: {
|
||||
Text(sort.title)
|
||||
.appFont(size: 16, weight: selectedSort == sort ? .bold : .medium)
|
||||
.foregroundColor(selectedSort == sort ? Color.white : Color.gray400)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.horizontal, SodaSpacing.s20)
|
||||
.frame(height: 52)
|
||||
.background(selectedSort == sort ? Color.gray900 : Color.black)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, SodaSpacing.s8)
|
||||
.background(Color.black)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelSortBottomSheet_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorChannelSortBottomSheet(selectedSort: .latest, onSelect: { _ in })
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user