diff --git a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentFilterSheet.swift b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentFilterSheet.swift index f7ef95bd..053945e3 100644 --- a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentFilterSheet.swift +++ b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentFilterSheet.swift @@ -45,7 +45,31 @@ struct RecruitmentFilterSheet: View { selectedOption() - techCodeList(techCodeList: viewModel.techCodeList) + VStack(alignment: .leading, spacing: 20) { + ForEach(viewModel.techCodeList, id: \.code) { code in + TechCodeListCell( + title: code.keyword, + isChecked: viewModel.selectedTechCode.contains(code) + ) { + withAnimation(.easeIn(duration: 0.3)) { + if viewModel.selectedTechCode.contains(code) { + viewModel.selectedTechCode.removeAll { $0 == code } + } else { + viewModel.selectedTechCode.append(code) + } + } + } + + if code != viewModel.techCodeList.last { + Divider() + .foregroundColor(.Sub.gray40) + } + } + + Spacer() + } + .padding(.bottom, 70) + .frame(maxHeight: .infinity) } .background(Color.Sub.gray10) } @@ -74,6 +98,8 @@ struct RecruitmentFilterSheet: View { .JOBISFont(.body(.body4), color: .Sub.gray90) Text( + viewModel.selectedJobCode?.keyword ?? "" + + (viewModel.selectedTechCode.isEmpty ? "": " | ") + viewModel.selectedTechCode.map { $0.keyword } .joined(separator: " | ") ) @@ -102,14 +128,14 @@ struct RecruitmentFilterSheet: View { items: jobCodeList, itemSpacing: 4 ) { jobCode in - let action = { - viewModel.selectedJobCode = viewModel.selectedJobCode == jobCode ? nil : jobCode - } - if viewModel.selectedJobCode == jobCode { - SolidBtn(text: jobCode.keyword, size: .small) { action() } + SolidBtn(text: jobCode.keyword, size: .small) { + viewModel.selectedJobCode = nil + } } else { - ShadowBtn(text: jobCode.keyword, size: .small) { action() } + ShadowBtn(text: jobCode.keyword, size: .small) { + viewModel.selectedJobCode = jobCode + } } } .padding(.vertical, 10) @@ -119,33 +145,4 @@ struct RecruitmentFilterSheet: View { } }) } - - @ViewBuilder - func techCodeList(techCodeList: [CodeEntity]) -> some View { - VStack(alignment: .leading, spacing: 20) { - ForEach(techCodeList, id: \.self) { code in - TechCodeListCell( - title: code.keyword, - isChecked: viewModel.selectedTechCode.contains(code) - ) { - withAnimation(.easeIn(duration: 0.3)) { - if viewModel.selectedTechCode.contains(code) { - viewModel.selectedTechCode.removeAll { $0 == code } - } else { - viewModel.selectedTechCode.append(code) - } - } - } - - if code != techCodeList.last { - Divider() - .foregroundColor(.Sub.gray40) - } - } - - Spacer() - } - .padding(.bottom, 70) - .frame(maxHeight: .infinity) - } } diff --git a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentListCell.swift b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentListCell.swift index 8acdac58..ce62e453 100644 --- a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentListCell.swift +++ b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/Components/RecruitmentListCell.swift @@ -5,26 +5,23 @@ import DesignSystem import Kingfisher struct RecruitmentListCell: View { - @Binding var recruitmentEntitys: [RecruitmentEntity] - let index: Int + @State private var isBookmarked: Bool = false + let recruitmentEntity: RecruitmentEntity let bookmark: () -> Void private let recruitmentDetailFactory: any RecruitmentDetailFactory init( - recruitmentEntitys: Binding<[RecruitmentEntity]>, - index: Int, + recruitmentEntity: RecruitmentEntity, recruitmentDetailFactory: any RecruitmentDetailFactory, bookmark: @escaping () -> Void ) { - _recruitmentEntitys = recruitmentEntitys - self.index = index + self.recruitmentEntity = recruitmentEntity self.bookmark = bookmark self.recruitmentDetailFactory = recruitmentDetailFactory } var body: some View { - let recruitmentEntity = recruitmentEntitys[index] NavigationLink { recruitmentDetailFactory.makeView( id: "\(recruitmentEntity.recruitID)", isDetail: false @@ -36,7 +33,7 @@ struct RecruitmentListCell: View { .cornerRadius(15) .padding(8) - VStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 4) { Text(recruitmentEntity.jobCodeList) .multilineTextAlignment(.leading) .JOBISFont(.body(.body2), color: .Sub.gray90) @@ -45,21 +42,18 @@ struct RecruitmentListCell: View { .JOBISFont(.etc(.caption), color: .Sub.gray60) Spacer() - - Text("실습 수당 \(recruitmentEntity.trainPay.intComma())만원") - .JOBISFont(.etc(.caption), color: .Sub.gray70) } .padding(.leading, 8) - .padding(.vertical, 14) + .padding(.top, 14) Spacer() VStack { - JOBISIcon(recruitmentEntity.bookmarked ? .bookmarkOn : .bookmarkOff) + JOBISIcon(self.isBookmarked ? .bookmarkOn : .bookmarkOff) .frame(width: 12, height: 16) .padding(5) .onTapGesture { - recruitmentEntitys[index].bookmarked.toggle() + isBookmarked.toggle() bookmark() } @@ -67,6 +61,7 @@ struct RecruitmentListCell: View { JOBISIcon(recruitmentEntity.military ? .militaryExceptionOn : .militaryExceptionOff) .frame(width: 20, height: 20) + .opacity(recruitmentEntity.military ? 1 : 0) } .padding(.vertical, 14) .padding(.trailing, 20) @@ -75,6 +70,9 @@ struct RecruitmentListCell: View { .background(Color.Sub.gray10) .cornerRadius(15) .shadow(color: .black, opacity: 0.1, blur: 4) + .onAppear { + self.isBookmarked = self.recruitmentEntity.bookmarked + } } } } diff --git a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/RecruitmentView.swift b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/RecruitmentView.swift index e737d5fb..0fb6b59b 100644 --- a/Projects/Feature/RecruitmentFeature/Sources/Recruitment/RecruitmentView.swift +++ b/Projects/Feature/RecruitmentFeature/Sources/Recruitment/RecruitmentView.swift @@ -24,25 +24,34 @@ struct RecruitmentView: View { LazyVStack { searchBar() - if !viewModel.recruitmentList.recruitments.isEmpty { - ForEach(0..