Skip to content

Commit

Permalink
Merge pull request #55 from Team-MindWay/54-book-open-page-publishing
Browse files Browse the repository at this point in the history
🔀 :: [#54] BookOrderPage 퍼블리싱
  • Loading branch information
kimkyumbi authored Apr 19, 2024
2 parents 56bad8d + 5777586 commit 1cafb32
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 31 deletions.
4 changes: 2 additions & 2 deletions App/Sources/DesignSystem/TextField/MindWayTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
32 changes: 19 additions & 13 deletions App/Sources/Feature/BookFeature/BookRecommendView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -15,7 +16,7 @@ struct RecommendBookView: View {
.padding(.horizontal, 12)
.padding(.vertical, 8)
.mindWaySemiboldFont(.m1)

if navigateTopBarStatus == false {
Rectangle()
.foregroundColor(.mindway(.main(.main)))
Expand All @@ -24,7 +25,7 @@ struct RecommendBookView: View {
}
}
}

Button {
navigateTopBarStatus = true
} label: {
Expand All @@ -34,7 +35,7 @@ struct RecommendBookView: View {
.padding(.horizontal, 12)
.padding(.vertical, 8)
.mindWaySemiboldFont(.m1)

if navigateTopBarStatus == true {
Rectangle()
.foregroundColor(.mindway(.main(.main)))
Expand All @@ -43,39 +44,44 @@ 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)
}
}
}
.tag(true)
}
.tabViewStyle(.page(indexDisplayMode: .never))
.padding(.vertical, 28)

}
.padding(.vertical, 20)
.padding(.horizontal, 24)
}
}
6 changes: 3 additions & 3 deletions App/Sources/Feature/BookFeature/Component/RecommendBook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
110 changes: 110 additions & 0 deletions App/Sources/Feature/BookOrderFeature/BookOrderView.swift
Original file line number Diff line number Diff line change
@@ -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)
)
}
}
11 changes: 11 additions & 0 deletions App/Sources/Feature/BookOrderFeature/BookOrderViewModel.swift
Original file line number Diff line number Diff line change
@@ -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
}
25 changes: 12 additions & 13 deletions App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
}
}
Expand All @@ -50,7 +50,7 @@ struct GoalReadingView: View {
MindWayAsset.Icons.addBlack.swiftUIImage
}
}

ToolbarItemGroup(placement: .principal) {
Text("목표 도서량")
.mindWaySemiboldFont(.m2)
Expand All @@ -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)
Expand Down

0 comments on commit 1cafb32

Please sign in to comment.