Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import React from 'react';
import PropTypes from 'prop-types';
import SiteSearchAPIConnector from '@elastic/search-ui-site-search-connector';
import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
import SearchBox from './search-box';
const connector = new SiteSearchAPIConnector({
engineKey: 'zpAwGSb8YMXtF9yDeS5K', // public engine key
engineName: 'docs',
documentType: ['page']
});
class Search extends React.Component {
render() {
const { props } = this;
const isIE11 =
typeof window !== 'undefined' &&
!!window.MSInputMethodContext &&
(typeof document !== 'undefined' && !!document.documentMode);
// do not load search component on IE 11
return isIE11 ? (
''
) : (
const SORT_OPTIONS = [
{
name: "Relevance",
value: "",
direction: ""
},
{
name: "Title",
value: "title",
direction: "asc"
}
];
let connector;
if (process.env.REACT_APP_SOURCE === "SITE_SEARCH") {
connector = new SiteSearchAPIConnector({
engineKey:
process.env.REACT_SITE_SEARCH_ENGINE_KEY || "Z43R5U3HiDsDgpKawZkA",
documentType: process.env.REACT_SITE_SEARCH_ENGINE_NAME || "national-parks"
});
} else {
connector = new AppSearchAPIConnector({
searchKey:
process.env.REACT_APP_SEARCH_KEY || "search-371auk61r2bwqtdzocdgutmg",
engineName:
process.env.REACT_APP_SEARCH_ENGINE_NAME || "search-ui-examples",
hostIdentifier:
process.env.REACT_APP_SEARCH_HOST_IDENTIFIER || "host-2376rb",
endpointBase: process.env.REACT_APP_SEARCH_ENDPOINT_BASE || ""
});
}