//
// SPDX-License-Identifier: AGPL-3.0
-import * as React from 'react';
+import React from 'react';
import { IconButton, StyleRulesCallback, withStyles, WithStyles, FormControl, InputLabel, Input, InputAdornment, Tooltip } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
interface SearchInputDataProps {
value: string;
+ label?: string;
}
interface SearchInputActionProps {
interface SearchInputState {
value: string;
+ label: string;
}
export const DEFAULT_SEARCH_DEBOUNCE = 1000;
export const SearchInput = withStyles(styles)(
class extends React.Component<SearchInputProps> {
state: SearchInputState = {
- value: ""
+ value: "",
+ label: ""
};
timeout: number;
render() {
return <form onSubmit={this.handleSubmit}>
<FormControl>
- <InputLabel>Search</InputLabel>
+ <InputLabel>{this.state.label}</InputLabel>
<Input
type="text"
value={this.state.value}
}
componentDidMount() {
- this.setState({ value: this.props.value });
+ this.setState({
+ value: this.props.value,
+ label: this.props.label || 'Search'
+ });
}
componentWillReceiveProps(nextProps: SearchInputProps) {