chore: update to beta of react-instantsearch-dom (#36843)

* chore: update to beta of react-instantsearch-dom

* feat: use .env variables for search keys
This commit is contained in:
Oliver Eyton-Williams
2019-10-04 18:03:20 +02:00
committed by GitHub
parent 203ca92a20
commit 1130a1c0df
5 changed files with 60 additions and 39 deletions

View File

@@ -6,6 +6,7 @@ import { InstantSearch, Configure } from 'react-instantsearch-dom';
import qs from 'query-string';
import { navigate } from 'gatsby';
import Media from 'react-responsive';
import algoliasearch from 'algoliasearch/lite';
import {
isSearchDropdownEnabledSelector,
@@ -13,11 +14,14 @@ import {
toggleSearchDropdown,
updateSearchQuery
} from './redux';
import { algoliaAppId, algoliaAPIKey } from '../../../config/env.json';
import { createSelector } from 'reselect';
const DEBOUNCE_TIME = 100;
const searchClient = algoliasearch(algoliaAppId, algoliaAPIKey);
const propTypes = {
children: PropTypes.any,
isDropdownEnabled: PropTypes.bool,
@@ -120,10 +124,9 @@ class InstantSearchRoot extends Component {
const MAX_MOBILE_HEIGHT = 768;
return (
<InstantSearch
apiKey='4318af87aa3ce128708f1153556c6108'
appId='QMJYL5WYTI'
indexName='news'
onSearchStateChange={this.onSearchStateChange}
searchClient={searchClient}
searchState={{ query }}
>
{this.isSearchPage() ? (