From e9ab93557ab9ec643512a875befc7c7b39c50854 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 15 Jun 2023 01:05:15 -0500 Subject: [PATCH] L --- src/components/SearchBar.tsx | 8 +++++--- src/components/SrsPart.tsx | 2 ++ src/components/VocabList.tsx | 2 +- src/index.d.ts | 0 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/index.d.ts diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 36de86f..30b2053 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -15,6 +15,10 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps) setSearchQuery(internalQuery); }; + let rightElement; + if (isLoading) rightElement = ; + else rightElement = ; + return (
@@ -26,9 +30,7 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps) value={internalQuery} onChange={(evt) => setInternalQuery(evt.target.value)} /> - - {{ false: , true: }[isLoading]} - + {rightElement}
); diff --git a/src/components/SrsPart.tsx b/src/components/SrsPart.tsx index 114e086..69660dd 100644 --- a/src/components/SrsPart.tsx +++ b/src/components/SrsPart.tsx @@ -1,4 +1,6 @@ +// @ts-ignore: https://git.mzhang.io/michael/houhou/issues/4 import buildFormatter from "react-timeago/es6/formatters/buildFormatter"; +// @ts-ignore: https://git.mzhang.io/michael/houhou/issues/4 import shortEnStrings from "react-timeago/es6/language-strings/en-short"; import classNames from "classnames"; import { KanjiSrsInfo } from "../lib/kanji"; diff --git a/src/components/VocabList.tsx b/src/components/VocabList.tsx index 8e64e2d..f6ebc1d 100644 --- a/src/components/VocabList.tsx +++ b/src/components/VocabList.tsx @@ -19,7 +19,7 @@ export default function VocabList({ className, kanjiId }: VocabListProps) { if (!data) { console.error(error); - return; + return <>Error {error}; } return ( diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..e69de29