import React from 'react';
import { FormGroup, Button, InputGroup } from 'react-bootstrap';
import { AsyncTypeahead } from 'react-bootstrap-typeahead';
import UserPicture from '../User/UserPicture';
import PageListMeta from '../PageList/PageListMeta';
import PagePath from '../PageList/PagePath';
// Header.SearchForm
export default class SearchForm extends React.Component {
constructor(props) {
super(props);
this.state = {
keyword: '',
searchedKeyword: '',
};
this.search = this.search.bind(this);
this.clearForm = this.clearForm.bind(this);
this.getFormClearComponent = this.getFormClearComponent.bind(this);
this.renderMenuItemChildren = this.renderMenuItemChildren.bind(this);
}
componentDidMount() {
}
componentWillUnmount() {
}
search(keyword) {
this.setState({keyword});
if (this.state.searchedKeyword != keyword) {
this.props.onSearchFormChanged({keyword});
this.setState({searchedKeyword: keyword});
}
}
getFormClearComponent() {
let isHidden = (this.state.keyword.length === 0);
return isHidden ? : (
);
}
clearForm() {
this._typeahead.getInstance().clear();
this.setState({keyword: ''});
}
renderMenuItemChildren(option, props, index) {
const page = option;
return (