신규 콘텐츠 메인
- NavigationView 추가
This commit is contained in:
		| @@ -41,93 +41,95 @@ struct ContentMainViewV2: View { | ||||
|     } | ||||
|      | ||||
|     var body: some View { | ||||
|         ZStack { | ||||
|              | ||||
|             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) | ||||
|         NavigationView { | ||||
|             ZStack { | ||||
|                 Color.black.ignoresSafeArea() | ||||
|                  | ||||
|                 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 | ||||
|                 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 | ||||
|                         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( | ||||
|                                         selectedTab == tabItem.tab ? | ||||
|                                             .button : | ||||
|                                                 .graybb | ||||
|                                     ) | ||||
|                                     .padding(.horizontal, 12) | ||||
|                                     .onTapGesture { | ||||
|                                         if selectedTab != tabItem.tab { | ||||
|                                             selectedTab = tabItem.tab | ||||
|                                             proxy.scrollTo(tabItem.tab, anchor: .center) | ||||
|                                         .foregroundColor( | ||||
|                                             selectedTab == tabItem.tab ? | ||||
|                                                 .button : | ||||
|                                                     .graybb | ||||
|                                         ) | ||||
|                                         .padding(.horizontal, 12) | ||||
|                                         .onTapGesture { | ||||
|                                             if selectedTab != tabItem.tab { | ||||
|                                                 selectedTab = tabItem.tab | ||||
|                                                 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) | ||||
|                         .padding(.horizontal, 13.3) | ||||
|                     } | ||||
|                     .onAppear { | ||||
|                         withAnimation { | ||||
|                             proxy.scrollTo(selectedTab, anchor: .center) | ||||
|                         } | ||||
|                     } | ||||
|                     .onChange(of: selectedTab) { newTab in | ||||
|                         withAnimation { | ||||
|                             if newTab == .HOME { | ||||
|                                 AppState.shared.back() | ||||
|                             } else { | ||||
|                                 proxy.scrollTo(newTab, anchor: .center) | ||||
|                         .onChange(of: selectedTab) { newTab in | ||||
|                             withAnimation { | ||||
|                                 if newTab == .HOME { | ||||
|                                     AppState.shared.back() | ||||
|                                 } else { | ||||
|                                     proxy.scrollTo(newTab, anchor: .center) | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                  | ||||
|                 ZStack { | ||||
|                     switch selectedTab { | ||||
|                     case .HOME: | ||||
|                         EmptyView() | ||||
|                     case .SERIES: | ||||
|                         ContentMainTabSeriesView() | ||||
|                     case .CONTENT: | ||||
|                         ContentMainTabContentView() | ||||
|                     case .ALARM: | ||||
|                         ContentMainTabAlarmView() | ||||
|                     case .ASMR: | ||||
|                         ContentMainTabAsmrView() | ||||
|                     case .REPLAY: | ||||
|                         ContentMainTabReplayView() | ||||
|                     case .FREE: | ||||
|                         ContentMainTabFreeView() | ||||
|                      | ||||
|                     ZStack { | ||||
|                         switch selectedTab { | ||||
|                         case .HOME: | ||||
|                             EmptyView() | ||||
|                         case .SERIES: | ||||
|                             ContentMainTabSeriesView() | ||||
|                         case .CONTENT: | ||||
|                             ContentMainTabContentView() | ||||
|                         case .ALARM: | ||||
|                             ContentMainTabAlarmView() | ||||
|                         case .ASMR: | ||||
|                             ContentMainTabAsmrView() | ||||
|                         case .REPLAY: | ||||
|                             ContentMainTabReplayView() | ||||
|                         case .FREE: | ||||
|                             ContentMainTabFreeView() | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             .navigationBarHidden(true) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung