mirror of
https://github.com/vercel/commerce.git
synced 2025-07-24 18:51:23 +00:00
Iterated search experience
This commit is contained in:
21
components/search/search-root.tsx
Normal file
21
components/search/search-root.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import algoliasearch from 'algoliasearch/lite';
|
||||
import { InstantSearch } from 'react-instantsearch';
|
||||
|
||||
const searchClient = algoliasearch(
|
||||
`${process.env.NEXT_PUBLIC_ALGOLIA_APPLICATION_ID}`,
|
||||
`${process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API_KEY}`
|
||||
);
|
||||
|
||||
interface SearchRootProps {
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
export default function SearchRoot({ children }: SearchRootProps) {
|
||||
return (
|
||||
<>
|
||||
<InstantSearch searchClient={searchClient} indexName="shopify_products">
|
||||
{children}
|
||||
</InstantSearch>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user