You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
681 B

import React from 'react';
import TextField from '@material-ui/core/TextField';
export class SearchBar extends React.Component {
state = {
text_value: false,
}
onSubmitHandler = () => { this.props.onSubmit(this.state.text_value); }
onChangeHandler = (e) => { this.setState({ text_value: e.target.value }); }
keyDownHandler = (e) => {
if (e.key === 'Enter') {
this.onSubmitHandler();
}
}
render() {
return (
<>
<TextField variant="outlined" fullWidth label="Search" type="text" onChange={this.onChangeHandler} onKeyDown={this.keyDownHandler} />
</>
);
}
}