import Inferno from 'inferno';
import Component from 'inferno-component';
import Helper from '../../../Helper';
import dictionary from '../../../managers/DictionaryData';
import METHOD from './SearchMethod.js';
export class SearchBox extends Component {
constructor (props) {
super(props);
this.state = {
searchingIn: 'name',
searchMethod: METHOD.contains,
searchTerm: '',
filteredPartsOfSpeech: [],
showHeader: false,
showAdvanced: false,
};
}
componentDidUpdate(prevProps, prevState) {
if (this.state.showHeader && this.searchBox) {
this.searchBox.focus();
}
}
search () {
const {searchingIn, searchMethod, searchTerm, filteredPartsOfSpeech} = this.state;
const searchConfig = {
searchingIn,
searchMethod,
searchTerm,
filteredPartsOfSpeech,
};
this.props.search(searchConfig);
}
displaySearchHeader () {
if (this.state.showHeader) {
return (
); }) }