forked from amand33p/bug-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilterBar.tsx
More file actions
53 lines (51 loc) · 1.54 KB
/
Copy pathFilterBar.tsx
File metadata and controls
53 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react';
import { TextField, InputAdornment, IconButton } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
import ClearIcon from '@material-ui/icons/Clear';
const FilterBar: React.FC<{
filterValue: string;
setFilterValue: (filterValue: string) => void;
label: string;
size?: 'small' | 'medium';
}> = ({ filterValue, setFilterValue, label, size }) => {
return (
<div>
<div>
<TextField
value={filterValue}
fullWidth
size={size || 'medium'}
type="text"
label={`Search ${label}`}
variant="outlined"
onChange={(e) => setFilterValue(e.target.value)}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<SearchIcon
color="primary"
fontSize={size === 'small' ? 'default' : 'large'}
/>
</InputAdornment>
),
endAdornment: (
<InputAdornment position="start">
{filterValue !== '' ? (
<IconButton onClick={() => setFilterValue('')} size="small">
<ClearIcon
color="primary"
fontSize={size === 'small' ? 'default' : 'large'}
/>
</IconButton>
) : (
<div></div>
)}
</InputAdornment>
),
}}
/>
</div>
</div>
);
};
export default FilterBar;