신규 콘텐츠 메인

- NavigationView 추가
This commit is contained in:
Yu Sung 2025-02-22 07:09:02 +09:00
parent 7c7d74b69c
commit fac5fe9a84
1 changed files with 78 additions and 76 deletions

View File

@ -41,93 +41,95 @@ struct ContentMainViewV2: View {
} }
var body: some View { var body: some View {
ZStack { NavigationView {
ZStack {
Color.black.ignoresSafeArea() Color.black.ignoresSafeArea()
VStack(spacing: 0) {
HStack(spacing: 0) {
Text("콘텐츠 마켓")
.font(.custom(Font.bold.rawValue, size: 21.3))
.foregroundColor(Color.button)
Spacer()
Image("ic_content_keep")
.onTapGesture {
AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist))
}
}
.padding(.horizontal, 13.3)
ScrollViewReader { proxy in VStack(spacing: 0) {
ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 0) {
HStack(spacing: 8) { Text("콘텐츠 마켓")
ForEach(0..<tabItemList.count, id: \.self) { index in .font(.custom(Font.bold.rawValue, size: 21.3))
let tabItem = tabItemList[index] .foregroundColor(Color.button)
Text(tabItem.title) Spacer()
.font(
.custom( Image("ic_content_keep")
selectedTab == tabItem.tab ? .onTapGesture {
Font.bold.rawValue : AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist))
Font.medium.rawValue, }
size: 16 }
.padding(.horizontal, 13.3)
ScrollViewReader { proxy in
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 8) {
ForEach(0..<tabItemList.count, id: \.self) { index in
let tabItem = tabItemList[index]
Text(tabItem.title)
.font(
.custom(
selectedTab == tabItem.tab ?
Font.bold.rawValue :
Font.medium.rawValue,
size: 16
)
) )
) .foregroundColor(
.foregroundColor( selectedTab == tabItem.tab ?
selectedTab == tabItem.tab ? .button :
.button : .graybb
.graybb )
) .padding(.horizontal, 12)
.padding(.horizontal, 12) .onTapGesture {
.onTapGesture { if selectedTab != tabItem.tab {
if selectedTab != tabItem.tab { selectedTab = tabItem.tab
selectedTab = tabItem.tab proxy.scrollTo(tabItem.tab, anchor: .center)
proxy.scrollTo(tabItem.tab, anchor: .center) }
} }
} .id(tabItem.tab)
.id(tabItem.tab) }
}
.padding(.vertical, 15)
.padding(.horizontal, 13.3)
}
.onAppear {
withAnimation {
proxy.scrollTo(selectedTab, anchor: .center)
} }
} }
.padding(.vertical, 15) .onChange(of: selectedTab) { newTab in
.padding(.horizontal, 13.3) withAnimation {
} if newTab == .HOME {
.onAppear { AppState.shared.back()
withAnimation { } else {
proxy.scrollTo(selectedTab, anchor: .center) proxy.scrollTo(newTab, anchor: .center)
} }
}
.onChange(of: selectedTab) { newTab in
withAnimation {
if newTab == .HOME {
AppState.shared.back()
} else {
proxy.scrollTo(newTab, anchor: .center)
} }
} }
} }
}
ZStack {
ZStack { switch selectedTab {
switch selectedTab { case .HOME:
case .HOME: EmptyView()
EmptyView() case .SERIES:
case .SERIES: ContentMainTabSeriesView()
ContentMainTabSeriesView() case .CONTENT:
case .CONTENT: ContentMainTabContentView()
ContentMainTabContentView() case .ALARM:
case .ALARM: ContentMainTabAlarmView()
ContentMainTabAlarmView() case .ASMR:
case .ASMR: ContentMainTabAsmrView()
ContentMainTabAsmrView() case .REPLAY:
case .REPLAY: ContentMainTabReplayView()
ContentMainTabReplayView() case .FREE:
case .FREE: ContentMainTabFreeView()
ContentMainTabFreeView() }
} }
} }
} }
.navigationBarHidden(true)
} }
} }
} }