Skip to content

Commit d1ce305

Browse files
committed
[fix] #203 검색 empty 추가, 정렬 버튼 누락 수정
1 parent 5f1b88b commit d1ce305

File tree

1 file changed

+55
-23
lines changed

1 file changed

+55
-23
lines changed

Projects/Feature/FeatureSetting/Sources/Search/PokitSearchView.swift

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -265,37 +265,69 @@ private extension PokitSearchView {
265265

266266
var resultList: some View {
267267
VStack(alignment: .leading, spacing: 20) {
268+
if store.isSearching {
269+
PokitIconLTextLink(
270+
store.isResultAscending ? "오래된순" : "최신순",
271+
icon: .icon(.align),
272+
action: { send(.정렬_버튼_눌렀을때) }
273+
)
274+
.contentTransition(.numericText())
275+
.padding(.horizontal, 20)
276+
}
277+
268278
if !store.isLoading {
269-
ScrollView {
270-
LazyVStack(spacing: 0) {
271-
ForEach(
272-
Array(store.scope(state: \.contents, action: \.contents))
273-
) { store in
274-
let isFirst = store.state.id == self.store.contents.first?.id
275-
let isLast = store.state.id == self.store.contents.last?.id
276-
277-
ContentCardView(
278-
store: store,
279-
type: .linkList,
280-
isFirst: isFirst,
281-
isLast: isLast
282-
)
283-
}
284-
285-
if store.hasNext {
286-
PokitLoading()
287-
.task { await send(.로딩중일때, animation: .pokitDissolve).finish() }
288-
}
289-
}
290-
.padding(.horizontal, 20)
291-
.padding(.bottom, 36)
279+
if store.contents.isEmpty && store.isSearching {
280+
resultEmptyLabel
281+
} else {
282+
resultListContent
292283
}
293284
} else {
294285
PokitLoading()
295286
}
296287
}
297288
.padding(.top, 24)
298289
}
290+
291+
var resultListContent: some View {
292+
ScrollView {
293+
LazyVStack(spacing: 0) {
294+
ForEach(
295+
Array(store.scope(state: \.contents, action: \.contents))
296+
) { store in
297+
let isFirst = store.state.id == self.store.contents.first?.id
298+
let isLast = store.state.id == self.store.contents.last?.id
299+
300+
ContentCardView(
301+
store: store,
302+
type: .linkList,
303+
isFirst: isFirst,
304+
isLast: isLast
305+
)
306+
}
307+
308+
if store.hasNext {
309+
PokitLoading()
310+
.task { await send(.로딩중일때, animation: .pokitDissolve).finish() }
311+
}
312+
}
313+
.padding(.horizontal, 20)
314+
.padding(.bottom, 36)
315+
}
316+
}
317+
318+
var resultEmptyLabel: some View {
319+
VStack(spacing: 8) {
320+
Text("검색어가 없어요")
321+
.pokitFont(.title2)
322+
323+
Text("링크 제목, 포킷으로 검색해주세요")
324+
.pokitFont(.b2(.m))
325+
}
326+
.padding(.top, 100)
327+
.padding(.bottom, 80)
328+
.frame(maxWidth: .infinity)
329+
.foregroundStyle(.pokit(.text(.tertiary)))
330+
}
299331
}
300332
//MARK: - Preview
301333
#Preview {

0 commit comments

Comments
 (0)