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