This commit is contained in:
Michael Zhang 2023-06-15 01:05:15 -05:00
parent ae4cc8cfe6
commit e9ab93557a
4 changed files with 8 additions and 4 deletions

View file

@ -15,6 +15,10 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps)
setSearchQuery(internalQuery);
};
let rightElement;
if (isLoading) rightElement = <Spinner />;
else rightElement = <SearchIcon />;
return (
<form onSubmit={onSubmit}>
<InputGroup>
@ -26,9 +30,7 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps)
value={internalQuery}
onChange={(evt) => setInternalQuery(evt.target.value)}
/>
<InputRightElement>
{{ false: <SearchIcon />, true: <Spinner /> }[isLoading]}
</InputRightElement>
<InputRightElement>{rightElement}</InputRightElement>
</InputGroup>
</form>
);

View file

@ -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";

View file

@ -19,7 +19,7 @@ export default function VocabList({ className, kanjiId }: VocabListProps) {
if (!data) {
console.error(error);
return;
return <>Error {error}</>;
}
return (

0
src/index.d.ts vendored Normal file
View file