// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { IconButton, Paper, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
+import { IconButton, Paper, StyleRulesCallback, withStyles, WithStyles, Tooltip } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
type CssRules = 'container' | 'input' | 'button';
timeout: number;
render() {
- const {classes} = this.props;
+ const { classes } = this.props;
return <Paper className={classes.container}>
<form onSubmit={this.handleSubmit}>
<input
placeholder="Search"
value={this.state.value}
/>
- <IconButton className={classes.button}>
- <SearchIcon/>
- </IconButton>
+ <Tooltip title='Search'>
+ <IconButton className={classes.button}>
+ <SearchIcon />
+ </IconButton>
+ </Tooltip>
</form>
</Paper>;
}
componentDidMount() {
- this.setState({value: this.props.value});
+ this.setState({ value: this.props.value });
}
componentWillReceiveProps(nextProps: SearchBarProps) {
if (nextProps.value !== this.props.value) {
- this.setState({value: nextProps.value});
+ this.setState({ value: nextProps.value });
}
}
handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
clearTimeout(this.timeout);
- this.setState({value: event.target.value});
+ this.setState({ value: event.target.value });
this.timeout = window.setTimeout(
() => this.props.onSearch(this.state.value),
this.props.debounce || DEFAULT_SEARCH_DEBOUNCE