aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Search/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Search/index.tsx')
-rw-r--r--src/components/Search/index.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx
index 4d1ae83..72ce8a1 100644
--- a/src/components/Search/index.tsx
+++ b/src/components/Search/index.tsx
@@ -8,9 +8,11 @@ import * as Styled from "./index.styled";
interface Props {
currentTry: number;
setSelectedSong: React.Dispatch<React.SetStateAction<Song | undefined>>;
+ /** Optional override of the song pool to search within. */
+ songs?: Song[];
}
-export function Search({ currentTry, setSelectedSong }: Props) {
+export function Search({ currentTry, setSelectedSong, songs }: Props) {
const [value, setValue] = React.useState("");
const [results, setResults] = React.useState<Song[]>([]);
@@ -20,8 +22,8 @@ export function Search({ currentTry, setSelectedSong }: Props) {
return;
}
- setResults(searchSong(value));
- }, [value]);
+ setResults(searchSong(value, songs));
+ }, [value, songs]);
React.useEffect(() => {
setValue("");
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage