|
@ -9,7 +9,7 @@ import {colors, media} from 'theme'; |
|
|
|
|
|
|
|
|
class DocSearch extends Component { |
|
|
class DocSearch extends Component { |
|
|
state = { |
|
|
state = { |
|
|
disabled: false, |
|
|
enabled: true, |
|
|
}; |
|
|
}; |
|
|
componentDidMount() { |
|
|
componentDidMount() { |
|
|
// Initialize Algolia search.
|
|
|
// Initialize Algolia search.
|
|
@ -22,14 +22,15 @@ class DocSearch extends Component { |
|
|
inputSelector: '#algolia-doc-search', |
|
|
inputSelector: '#algolia-doc-search', |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.setState({disabled: true}); |
|
|
console.warn('Search has failed to load and now is being disabled'); |
|
|
|
|
|
this.setState({enabled: false}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
const {disabled} = this.state; |
|
|
const {enabled} = this.state; |
|
|
|
|
|
|
|
|
return ( |
|
|
return enabled ? ( |
|
|
<form |
|
|
<form |
|
|
css={{ |
|
|
css={{ |
|
|
display: 'flex', |
|
|
display: 'flex', |
|
@ -56,7 +57,6 @@ class DocSearch extends Component { |
|
|
}, |
|
|
}, |
|
|
}}> |
|
|
}}> |
|
|
<input |
|
|
<input |
|
|
disabled={disabled} |
|
|
|
|
|
css={{ |
|
|
css={{ |
|
|
appearance: 'none', |
|
|
appearance: 'none', |
|
|
background: 'transparent', |
|
|
background: 'transparent', |
|
@ -103,7 +103,7 @@ class DocSearch extends Component { |
|
|
aria-label="Search docs" |
|
|
aria-label="Search docs" |
|
|
/> |
|
|
/> |
|
|
</form> |
|
|
</form> |
|
|
); |
|
|
) : null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|