-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demos/Recent games: Add matchtag filter (#98)
* Update dependencies. * Reformat code. * Add matchtag filter.
- Loading branch information
Showing
8 changed files
with
574 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { faTag } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { type ChangeEvent, useEffect } from "react"; | ||
import { useDebounceValue } from "usehooks-ts"; | ||
import { formInput } from "../../ui/theme.ts"; | ||
import { useGameSettings } from "./context.tsx"; | ||
|
||
export const Matchtag = () => { | ||
const { matchtag, setMatchtag } = useGameSettings(); | ||
const [value, setValue] = useDebounceValue<string>(matchtag, 400); | ||
|
||
function handleChange(e: ChangeEvent<HTMLInputElement>) { | ||
setValue(e.target.value.toLowerCase().trim()); | ||
} | ||
|
||
useEffect(() => { | ||
setMatchtag(value); | ||
}, [value]); | ||
|
||
return ( | ||
<label className="flex items-center ml-2" title="Matchtag"> | ||
<FontAwesomeIcon | ||
icon={faTag} | ||
className="z-10 text-slate-500 pointer-events-none" | ||
size="xs" | ||
/> | ||
<input | ||
type="search" | ||
defaultValue={matchtag} | ||
className={`${formInput} -ml-6 pl-8 w-24`} | ||
onChange={handleChange} | ||
/> | ||
</label> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.