forked from amand33p/bug-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortBar.tsx
More file actions
46 lines (43 loc) · 1.17 KB
/
Copy pathSortBar.tsx
File metadata and controls
46 lines (43 loc) · 1.17 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
import React from 'react';
import {
FormControl,
InputLabel,
Select,
MenuItem,
InputAdornment,
} from '@material-ui/core';
import SortIcon from '@material-ui/icons/Sort';
const SortBar: React.FC<{
sortBy: string;
handleSortChange: (e: React.ChangeEvent<{ value: unknown }>) => void;
menuItems: { value: string; label: string }[];
label: string;
size?: 'small' | 'medium';
}> = ({ sortBy, handleSortChange, menuItems, label, size }) => {
return (
<FormControl variant="outlined" fullWidth size={size || 'medium'}>
<InputLabel id="sort-label">Sort {label} By</InputLabel>
<Select
labelId="sort-label"
value={sortBy}
onChange={handleSortChange}
label={`Sort ${label} By`}
startAdornment={
<InputAdornment position="start">
<SortIcon
color="primary"
fontSize={size === 'small' ? 'default' : 'large'}
/>
</InputAdornment>
}
>
{menuItems.map((m) => (
<MenuItem key={m.value} value={m.value}>
{m.label}
</MenuItem>
))}
</Select>
</FormControl>
);
};
export default SortBar;