mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Add console.warn and move DocSearch component to LayoutHeader
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* @emails react-core
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import DocSearch from './DocSearch';
|
||||
|
||||
export default DocSearch;
|
||||
@@ -9,7 +9,7 @@ import {colors, media} from 'theme';
|
||||
|
||||
class DocSearch extends Component {
|
||||
state = {
|
||||
disabled: false,
|
||||
enabled: true,
|
||||
};
|
||||
componentDidMount() {
|
||||
// Initialize Algolia search.
|
||||
@@ -22,14 +22,15 @@ class DocSearch extends Component {
|
||||
inputSelector: '#algolia-doc-search',
|
||||
});
|
||||
} else {
|
||||
this.setState({disabled: true});
|
||||
console.warn('Search has failed to load and now is being disabled');
|
||||
this.setState({enabled: false});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {disabled} = this.state;
|
||||
const {enabled} = this.state;
|
||||
|
||||
return (
|
||||
return enabled ? (
|
||||
<form
|
||||
css={{
|
||||
display: 'flex',
|
||||
@@ -56,7 +57,6 @@ class DocSearch extends Component {
|
||||
},
|
||||
}}>
|
||||
<input
|
||||
disabled={disabled}
|
||||
css={{
|
||||
appearance: 'none',
|
||||
background: 'transparent',
|
||||
@@ -103,7 +103,7 @@ class DocSearch extends Component {
|
||||
aria-label="Search docs"
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import React from 'react';
|
||||
import {colors, fonts, media} from 'theme';
|
||||
import {version} from 'site-constants';
|
||||
import ExternalLinkSvg from 'templates/components/ExternalLinkSvg';
|
||||
import DocSearch from 'components/DocSearch';
|
||||
import DocSearch from './DocSearch';
|
||||
|
||||
import logoSvg from 'icons/logo.svg';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user