Skip to content

Commit

Permalink
feat:#80-nilCheck_update
Browse files Browse the repository at this point in the history
feat:#80-nilCheck_update_forPush
  • Loading branch information
hyeonheebee committed Nov 21, 2024
1 parent 1c2bb42 commit 928a7c3
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import SwiftUI
struct BookListView: View {
@ObservedObject var bookSearchViewModel: BookSearchViewModel
@State private var searchText: String = ""

@State private var isSearchButtonClicked: Bool = false
private let placeholder: String = "μ–΄λ–€ 책을 μ™„λ…ν•˜κ³  μ‹Άλ‚˜μš”?"

var body: some View {

VStack(spacing: 40) {

VStack(spacing: 0) {

HStack(spacing: 0) {
TextField("",
text: $searchText,
Expand All @@ -25,6 +28,7 @@ struct BookListView: View {
)
.onSubmit {
requestSearchBooks()
isSearchButtonClicked = true
}
.font(.system(size: 16))
.foregroundColor(.black)
Expand All @@ -33,6 +37,7 @@ struct BookListView: View {

Button {
requestSearchBooks()
isSearchButtonClicked = true
} label: {
Image(systemName: "magnifyingglass")
.foregroundColor(Color(red: 0.74, green: 0.74, blue: 0.74))
Expand All @@ -52,11 +57,21 @@ struct BookListView: View {
.padding(.horizontal, 20)

ScrollView {
ForEach(bookSearchViewModel.books) { book in
BookRowView(viewModel: bookSearchViewModel, book: book)
if bookSearchViewModel.books.isEmpty && isSearchButtonClicked {
Text("검색 κ²°κ³Όκ°€ μ—†μ–΄μš”!\n검색어λ₯Ό λ‹€μ‹œ ν™•μΈν•΄μ£Όμ„Έμš”")
.font(Font.custom("Pretendard Variable", size: 14))
.multilineTextAlignment(.center)
.foregroundColor(Color(red: 0.24, green: 0.24, blue: 0.26).opacity(0.6))
.frame(width: 193, alignment: .top)

} else {
ForEach(bookSearchViewModel.books) { book in
BookRowView(viewModel: bookSearchViewModel, book: book)
} .background(.white)
}

}
.background(.white)

}
}

Expand Down

0 comments on commit 928a7c3

Please sign in to comment.