mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: refactor
This commit is contained in:
parent
b0164b6948
commit
ad3c2df024
@ -72,6 +72,32 @@ export function SearchResults() {
|
|||||||
debouncedFunc.current();
|
debouncedFunc.current();
|
||||||
}, [searchParams, dispatch]);
|
}, [searchParams, dispatch]);
|
||||||
|
|
||||||
|
const noResultsContent = () => {
|
||||||
|
if (isLoading) return null;
|
||||||
|
|
||||||
|
if (showTypingMessage) {
|
||||||
|
return (
|
||||||
|
<div className={styles.noResults}>
|
||||||
|
<SearchIcon size={56} />
|
||||||
|
|
||||||
|
<p>{t("start_typing")}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchResults.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className={styles.noResults}>
|
||||||
|
<InboxIcon size={56} />
|
||||||
|
|
||||||
|
<p>{t("no_results")}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444">
|
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444">
|
||||||
<section className={styles.content}>
|
<section className={styles.content}>
|
||||||
@ -94,21 +120,7 @@ export function SearchResults() {
|
|||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{!isLoading && showTypingMessage && (
|
{noResultsContent()}
|
||||||
<div className={styles.noResults}>
|
|
||||||
<SearchIcon size={56} />
|
|
||||||
|
|
||||||
<p>{t("start_typing")}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoading && searchResults.length === 0 && (
|
|
||||||
<div className={styles.noResults}>
|
|
||||||
<InboxIcon size={56} />
|
|
||||||
|
|
||||||
<p>{t("no_results")}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</section>
|
</section>
|
||||||
</SkeletonTheme>
|
</SkeletonTheme>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user