kafka-ui/kafka-ui-react-app/src/components/common/Search/Search.tsx
Arsen Simonyan 521ba0cb2f
Improve live tailing. (#1898)
* disable filter options when live tailing mode is enabled

* prevent seek direction change when stop loading is pressed on live mode

* disable submit button while tailing

* write tests for MultiSelect.styled component to achieve 100% coverage
2022-05-02 10:05:24 +04:00

36 lines
720 B
TypeScript

import React from 'react';
import { useDebouncedCallback } from 'use-debounce';
import Input from 'components/common/Input/Input';
interface SearchProps {
handleSearch: (value: string) => void;
placeholder?: string;
value: string;
disabled?: boolean;
}
const Search: React.FC<SearchProps> = ({
handleSearch,
placeholder = 'Search',
value,
disabled = false,
}) => {
const onChange = useDebouncedCallback(
(e) => handleSearch(e.target.value),
300
);
return (
<Input
type="text"
placeholder={placeholder}
onChange={onChange}
defaultValue={value}
leftIcon="fas fa-search"
inputSize="M"
disabled={disabled}
/>
);
};
export default Search;