Skip to content

Commit

Permalink
fix: search panel loading spinner bug
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Feb 4, 2024
1 parent 8844c36 commit 33fa4ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/components/modules/shared/SearchFAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ const SearchPanelImpl = () => {
)

const isLogged = useIsLogged()

return (
<m.div
className={clsx(
Expand Down Expand Up @@ -266,9 +267,9 @@ const SearchPanelImpl = () => {
<div className="flex flex-col items-center space-y-2">
{!keyword ? (
<i className="icon-[mingcute--search-line] text-[60px]" />
) : !isLoading ? (
) : (
<EmptyIcon />
) : null}
)}

{!data && isLoading && isFetching && (
<div className="loading-dots text-[30px]" />
Expand All @@ -281,6 +282,12 @@ const SearchPanelImpl = () => {
return <SearchItem key={item.id} {...item} index={index} />
})
)}

{data.length === 0 && isLoading && (
<div className="flex h-full flex-grow center">
<div className="loading loading-spinner" />
</div>
)}
</ul>
</div>

Expand Down
4 changes: 3 additions & 1 deletion src/hooks/common/use-input-composition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useRef } from 'react'
import type { CompositionEventHandler } from 'react'

export const useInputComposition = (
props:
props: Pick<
| React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
Expand All @@ -11,6 +11,8 @@ export const useInputComposition = (
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
HTMLTextAreaElement
>,
'onKeyDown' | 'onCompositionEnd' | 'onCompositionStart'
>,
) => {
const { onKeyDown, onCompositionStart, onCompositionEnd } = props

Expand Down

0 comments on commit 33fa4ba

Please sign in to comment.