-
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.
Merge pull request #29 from canisterism/search
Search
- Loading branch information
Showing
12 changed files
with
372 additions
and
99 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
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,28 @@ | ||
"use client"; | ||
import { MagnifyingGlassIcon } from "@heroicons/react/20/solid"; | ||
import { useSearchBox } from "react-instantsearch-hooks"; | ||
|
||
export default function SearchBox() { | ||
const { query, refine } = useSearchBox(); | ||
return ( | ||
<form className="relative flex flex-1" action="#" method="GET"> | ||
<label htmlFor="search-field" className="sr-only"> | ||
Search | ||
</label> | ||
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"> | ||
<MagnifyingGlassIcon | ||
className="h-5 w-5 text-gray-400" | ||
aria-hidden="true" | ||
/> | ||
</div> | ||
<input | ||
id="search-field" | ||
className="block h-full w-full border-0 rounded-md py-1.5 pl-10 pr-3 bg-gray-700 text-gray-200 placeholder:text-gray-400 focus:bg-white focus:text-gray-900 focus:ring-0 sm:text-sm" | ||
placeholder="Search..." | ||
type="search" | ||
name="search" | ||
onChange={(event) => refine(event.target.value)} | ||
/> | ||
</form> | ||
); | ||
} |
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,18 @@ | ||
import algoliasearch from "algoliasearch/lite"; | ||
import { InstantSearch } from "react-instantsearch-hooks-web"; | ||
|
||
const searchClient = algoliasearch( | ||
"ARQKR6LI32", | ||
"0a0fcaec0b67c57e920f515c98da855c" | ||
); | ||
|
||
const indexName = | ||
process.env.NODE_ENV == "development" | ||
? "development_games" | ||
: "production_games"; | ||
|
||
export const AlgoliaContext = ({ children }: { children: React.ReactNode }) => ( | ||
<InstantSearch searchClient={searchClient} indexName={indexName} insights> | ||
{children} | ||
</InstantSearch> | ||
); |
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.