60 lines
1.7 KiB
Swift
60 lines
1.7 KiB
Swift
import SwiftUI
|
|
|
|
struct CreatorChannelCommunityViewModeBar: View {
|
|
let communityPostCount: Int
|
|
let viewMode: CreatorChannelCommunityViewMode
|
|
let onTapToggle: () -> Void
|
|
|
|
var body: some View {
|
|
HStack(alignment: .center, spacing: SodaSpacing.s8) {
|
|
HStack(spacing: SodaSpacing.s4) {
|
|
Text(I18n.CreatorChannelCommunity.totalLabel)
|
|
.appFont(size: 16, weight: .medium)
|
|
.foregroundColor(.white)
|
|
|
|
Text("\(communityPostCount)")
|
|
.appFont(size: 16, weight: .medium)
|
|
.foregroundColor(Color.gray500)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button(action: onTapToggle) {
|
|
HStack(spacing: SodaSpacing.s4) {
|
|
Text(viewModeTitle)
|
|
.appFont(size: 16, weight: .regular)
|
|
.foregroundColor(Color.gray400)
|
|
|
|
Image(viewModeIconName)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(width: 18, height: 18)
|
|
}
|
|
.contentShape(Rectangle())
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
.padding(.horizontal, SodaSpacing.s14)
|
|
.frame(height: 52)
|
|
.background(Color.black)
|
|
}
|
|
|
|
private var viewModeTitle: String {
|
|
switch viewMode {
|
|
case .list:
|
|
return I18n.CreatorChannelCommunity.listView
|
|
case .thumbnail:
|
|
return I18n.CreatorChannelCommunity.thumbnailView
|
|
}
|
|
}
|
|
|
|
private var viewModeIconName: String {
|
|
switch viewMode {
|
|
case .list:
|
|
return "ic_new_list"
|
|
case .thumbnail:
|
|
return "ic_new_grid"
|
|
}
|
|
}
|
|
}
|