diff --git a/App/Sources/DesignSystem/TextField/MindWayTextField.swift b/App/Sources/DesignSystem/TextField/MindWayTextField.swift index 39a784d..a3dc813 100644 --- a/App/Sources/DesignSystem/TextField/MindWayTextField.swift +++ b/App/Sources/DesignSystem/TextField/MindWayTextField.swift @@ -42,16 +42,16 @@ struct MindWayTextField: View { TextField(placeholder, text: $text) .padding(.horizontal, 16) .frame(height: 56) - .cornerRadius(8) .onSubmit(onSubmit) .focused($isFocused) .foregroundColor(.mindway(.black(.black))) - .background(borderColor) + .background(Color.mindway(.gray(.g1))) .mindWayRegularFont(.m3) .overlay { RoundedRectangle(cornerRadius: 8) .strokeBorder(borderColor) } + .cornerRadius(8) .onTapGesture { isFocused = true } diff --git a/App/Sources/Feature/BookFeature/BookRecommendView.swift b/App/Sources/Feature/BookFeature/BookRecommendView.swift index c9436e0..45c6703 100644 --- a/App/Sources/Feature/BookFeature/BookRecommendView.swift +++ b/App/Sources/Feature/BookFeature/BookRecommendView.swift @@ -2,7 +2,8 @@ import SwiftUI struct RecommendBookView: View { @State private var navigateTopBarStatus: Bool = false - + @State var isBookOrder: Bool = false + var body: some View { VStack { HStack(spacing: 20) { @@ -15,7 +16,7 @@ struct RecommendBookView: View { .padding(.horizontal, 12) .padding(.vertical, 8) .mindWaySemiboldFont(.m1) - + if navigateTopBarStatus == false { Rectangle() .foregroundColor(.mindway(.main(.main))) @@ -24,7 +25,7 @@ struct RecommendBookView: View { } } } - + Button { navigateTopBarStatus = true } label: { @@ -34,7 +35,7 @@ struct RecommendBookView: View { .padding(.horizontal, 12) .padding(.vertical, 8) .mindWaySemiboldFont(.m1) - + if navigateTopBarStatus == true { Rectangle() .foregroundColor(.mindway(.main(.main))) @@ -43,30 +44,34 @@ struct RecommendBookView: View { } } } - + Spacer() - + MindWayAsset.Icons.addBlack.swiftUIImage - .buttonWrapper {} + .buttonWrapper { + isBookOrder = true + } + .fullScreenCover( + isPresented: $isBookOrder + ) { + BookOrderView() + } } - .padding(.horizontal, 24) - + TabView(selection: $navigateTopBarStatus) { ScrollView(showsIndicators: false) { VStack(spacing: 20) { ForEach(1...5, id: \.self) { _ in RecommendBook() - .padding(.horizontal, 24) } } } .tag(false) - + ScrollView(showsIndicators: false) { VStack(spacing: 20) { ForEach(1...5, id: \.self) { _ in RecommendBook() - .padding(.horizontal, 24) } } } @@ -74,8 +79,9 @@ struct RecommendBookView: View { } .tabViewStyle(.page(indexDisplayMode: .never)) .padding(.vertical, 28) - + } .padding(.vertical, 20) + .padding(.horizontal, 24) } } diff --git a/App/Sources/Feature/BookFeature/Component/RecommendBook.swift b/App/Sources/Feature/BookFeature/Component/RecommendBook.swift index a075b1e..bf0e906 100644 --- a/App/Sources/Feature/BookFeature/Component/RecommendBook.swift +++ b/App/Sources/Feature/BookFeature/Component/RecommendBook.swift @@ -6,14 +6,14 @@ struct RecommendBook: View { HStack { Text("네가 마지막으로 남긴 노래") .mindWaySemiboldFont(.m3) - + Spacer() - + Text("이치조 미사키") .mindWayRegularFont(.label) .foregroundColor(.mindway(.gray(.g4))) } - + Text("내가 사랑해 마지않는 네가 마지막으로 남긴 노래를 들었다.") .mindWayRegularFont(.m3) .foregroundColor(.mindway(.gray(.g8))) diff --git a/App/Sources/Feature/BookOrderFeature/BookOrderView.swift b/App/Sources/Feature/BookOrderFeature/BookOrderView.swift new file mode 100644 index 0000000..7372c23 --- /dev/null +++ b/App/Sources/Feature/BookOrderFeature/BookOrderView.swift @@ -0,0 +1,110 @@ +import SwiftUI + +struct BookOrderView: View { + @StateObject var viewModel = BookOrderViewModel() + @Environment(\.dismiss) var dismiss + + var body: some View { + ZStack { + NavigationView { + VStack(spacing: 0) { + VStack(spacing: 28) { + MindWayTextField( + "책 제목을 입력해주세요.", + text: $viewModel.bookTitle, + title: "제목", + errorText: "올바른 책 제목을 입력해주세요.", + isError: viewModel.titleError + ) + + MindWayTextField( + "저자를 입력해주세요.", + text: $viewModel.bookAuthor, + title: "저자", + errorText: "올바른 책 제목을 입력해주세요.", + isError: viewModel.authorError + ) + + MindWayTextField( + "YES24 링크를 입력해주세요.", + text: $viewModel.bookURL, + title: "링크", + errorText: "올바른 YES24 링크를 입력해주세요.", + isError: viewModel.linkError + ) + } + .padding(.vertical, 28) + .padding(.top, -48) + + Spacer() + + MindWayButton( + text: "적용하기", + buttonStyle: .default + ) { + viewModel.titleError = viewModel.bookTitle.isEmpty + viewModel.authorError = viewModel.bookAuthor.isEmpty + viewModel.linkError = viewModel.bookURL.isEmpty + + if !viewModel.bookURL.isEmpty + && !viewModel.bookAuthor.isEmpty + && !viewModel.bookTitle.isEmpty { + dismiss() + } + } + .padding(.bottom, 20) + } + .padding(.horizontal, 24) + .mindWayBackButton(dismiss: dismiss) + .toolbar { + ToolbarItem(placement: .principal) { + Text("도서 신청") + .mindWaySemiboldFont(.m2) + } + + ToolbarItem(placement: .navigationBarTrailing) { + Button { + viewModel.isWarning = true + } label: { + MindWayAsset.Icons.exclamationmark.swiftUIImage + } + } + } + } + + if viewModel.isWarning == true { + Color.mindway(.black(.black)) + .ignoresSafeArea() + .opacity(0.4) + + warningPopup() + .padding(.horizontal, 24) + + #warning("Animation 추가(가능하다면)") + } + } + } + + @ViewBuilder + func warningPopup() -> some View { + VStack(spacing: 28) { + Text("신청하려는 책이 도서관에 있는지 확인해주세요. \n부적절한 도서 신청시 통보없이 삭제되며, \n후에 불이익이 있을 수 있습니다.") + .multilineTextAlignment(.center) + .mindWayRegularFont(.m3) + + MindWayButton( + text: "확인", + buttonStyle: .default + ) { + viewModel.isWarning = false + } + } + .padding(.horizontal, 24) + .padding(.top, 24) + .padding(.bottom, 20) + .background( + Color.mindway(.white(.white)) + .cornerRadius(8) + ) + } +} diff --git a/App/Sources/Feature/BookOrderFeature/BookOrderViewModel.swift b/App/Sources/Feature/BookOrderFeature/BookOrderViewModel.swift new file mode 100644 index 0000000..bd557c3 --- /dev/null +++ b/App/Sources/Feature/BookOrderFeature/BookOrderViewModel.swift @@ -0,0 +1,11 @@ +import Foundation + +final class BookOrderViewModel: ObservableObject { + @Published var bookTitle: String = "" + @Published var bookAuthor: String = "" + @Published var bookURL: String = "" + @Published var titleError: Bool = false + @Published var authorError: Bool = false + @Published var linkError: Bool = false + @Published var isWarning: Bool = false +} diff --git a/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift b/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift index ef49b96..a2178ac 100644 --- a/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift +++ b/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift @@ -3,10 +3,10 @@ import SwiftUI struct GoalReadingView: View { @Environment(\.dismiss) var dismiss @State var isShowingSettingPage = false - + var week: [String] = ["일", "월", "화", "수", "목", "금", "토"] var bookCount: [Int] = [0, 2, 2, 4, 1, 0, 0] - + var body: some View { NavigationView { ZStack { @@ -18,27 +18,27 @@ struct GoalReadingView: View { .shadow(color: .black.opacity(0.05), radius: 10, x: 0) .padding(.horizontal, 24) .padding(.top, 20) - + GoalReadingGraph( bookCount: bookCount, week: week ) } - + ZStack { RoundedRectangle(cornerRadius: 8) .frame(height: 60) .foregroundColor(.mindway(.white(.white))) .shadow(color: .black.opacity(0.05), radius: 10, x: 0) .padding(.horizontal, 24) - + MindWayAsset.Icons.addMain.swiftUIImage } - + ForEach(0..<2, id: \.self) { _ in readingBookList() } - + Spacer() } } @@ -50,7 +50,7 @@ struct GoalReadingView: View { MindWayAsset.Icons.addBlack.swiftUIImage } } - + ToolbarItemGroup(placement: .principal) { Text("목표 도서량") .mindWaySemiboldFont(.m2) @@ -61,23 +61,22 @@ struct GoalReadingView: View { .mindWayBottomSheet(isShowing: $isShowingSettingPage) { SettingGoalReadingView(viewModel: GoalReadingViewModel()) } - } - + @ViewBuilder func readingBookList() -> some View { VStack(alignment: .leading, spacing: 8) { HStack { Text("세상의 마지막 기차역") .mindWaySemiboldFont(.m1) - + Spacer() - + Text("3월 22일") .mindWayRegularFont(.label) .foregroundColor(.mindway(.gray(.g4))) } - + Text("세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마지막 기차역세상의 마") .mindWayRegularFont(.m3) .lineLimit(3)