|
|
@ -9,25 +9,25 @@ import {colors, media} from 'theme'; |
|
|
|
|
|
|
|
class DocSearch extends Component { |
|
|
|
state = { |
|
|
|
disabled: false |
|
|
|
} |
|
|
|
disabled: false, |
|
|
|
}; |
|
|
|
componentDidMount() { |
|
|
|
// Initialize Algolia search.
|
|
|
|
// TODO Is this expensive? Should it be deferred until a user is about to search?
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
if(window.docsearch) { |
|
|
|
if (window.docsearch) { |
|
|
|
docsearch({ |
|
|
|
apiKey: '36221914cce388c46d0420343e0bb32e', |
|
|
|
indexName: 'react', |
|
|
|
inputSelector: '#algolia-doc-search', |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.setState({ disabled: true}) |
|
|
|
this.setState({disabled: true}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
render() { |
|
|
|
const {disabled} = this.state |
|
|
|
const {disabled} = this.state; |
|
|
|
|
|
|
|
return ( |
|
|
|
<form |
|
|
|