fix(creator): 선택 탭을 가운데 정렬한다
This commit is contained in:
@@ -4,26 +4,34 @@ struct CreatorChannelTabBar: View {
|
||||
@Binding var selectedTab: CreatorChannelTab
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(CreatorChannelTab.allCases, id: \.self) { tab in
|
||||
Button {
|
||||
selectedTab = tab
|
||||
} label: {
|
||||
VStack(spacing: 0) {
|
||||
Text(tab.title)
|
||||
.appFont(size: 16, weight: .medium)
|
||||
.foregroundColor(selectedTab == tab ? Color.white : Color.gray500)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(CreatorChannelTab.allCases, id: \.self) { tab in
|
||||
Button {
|
||||
selectedTab = tab
|
||||
} label: {
|
||||
VStack(spacing: 0) {
|
||||
Text(tab.title)
|
||||
.appFont(size: 16, weight: .medium)
|
||||
.foregroundColor(selectedTab == tab ? Color.white : Color.gray500)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
|
||||
Rectangle()
|
||||
.fill(selectedTab == tab ? Color.soda400 : Color.clear)
|
||||
.frame(height: 3)
|
||||
Rectangle()
|
||||
.fill(selectedTab == tab ? Color.soda400 : Color.clear)
|
||||
.frame(height: 3)
|
||||
}
|
||||
.frame(width: 110, height: 52)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.frame(width: 110, height: 52)
|
||||
.contentShape(Rectangle())
|
||||
.buttonStyle(.plain)
|
||||
.id(tab)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
.onChange(of: selectedTab) { tab in
|
||||
withAnimation {
|
||||
proxy.scrollTo(tab, anchor: .center)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ struct CreatorChannelView: View {
|
||||
onTapCommunityLike: viewModel.likeCommunityPost
|
||||
)
|
||||
} else {
|
||||
CreatorChannelPlaceholderTabView(title: viewModel.selectedTab.title)
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user