mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 14:06:59 +00:00
22 lines
550 B
TypeScript
22 lines
550 B
TypeScript
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>
|
|
</>
|
|
);
|
|
}
|