L
This commit is contained in:
parent
ae4cc8cfe6
commit
e9ab93557a
4 changed files with 8 additions and 4 deletions
|
@ -15,6 +15,10 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps)
|
||||||
setSearchQuery(internalQuery);
|
setSearchQuery(internalQuery);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let rightElement;
|
||||||
|
if (isLoading) rightElement = <Spinner />;
|
||||||
|
else rightElement = <SearchIcon />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={onSubmit}>
|
<form onSubmit={onSubmit}>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
|
@ -26,9 +30,7 @@ export default function SearchBar({ isLoading, setSearchQuery }: SearchBarProps)
|
||||||
value={internalQuery}
|
value={internalQuery}
|
||||||
onChange={(evt) => setInternalQuery(evt.target.value)}
|
onChange={(evt) => setInternalQuery(evt.target.value)}
|
||||||
/>
|
/>
|
||||||
<InputRightElement>
|
<InputRightElement>{rightElement}</InputRightElement>
|
||||||
{{ false: <SearchIcon />, true: <Spinner /> }[isLoading]}
|
|
||||||
</InputRightElement>
|
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
// @ts-ignore: https://git.mzhang.io/michael/houhou/issues/4
|
||||||
import buildFormatter from "react-timeago/es6/formatters/buildFormatter";
|
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 shortEnStrings from "react-timeago/es6/language-strings/en-short";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { KanjiSrsInfo } from "../lib/kanji";
|
import { KanjiSrsInfo } from "../lib/kanji";
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default function VocabList({ className, kanjiId }: VocabListProps) {
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return;
|
return <>Error {error}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
0
src/index.d.ts
vendored
Normal file
0
src/index.d.ts
vendored
Normal file
Loading…
Reference in a new issue