-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathcustomize.dialog.component.tsx
71 lines (69 loc) · 1.73 KB
/
customize.dialog.component.tsx
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from 'react'
import {
Dialog,
DialogTitle,
DialogContent,
DialogActions,
Button,
FormControlLabel,
Checkbox,
List,
ListItem,
Box
} from '@mui/material'
import {CustomizeDialogProps} from '../../interfaces/index.interface'
const CustomizeDialog: React.FC<CustomizeDialogProps> = ({
open,
onClose,
onApply,
visibleFilters,
handleFilterVisibilityChange,
onRestoreDefaults,
isDefaultState
}) => {
return (
<Dialog open={open} onClose={onClose} fullWidth>
<DialogTitle>Customize displayed filters</DialogTitle>
<DialogContent>
<List>
{Object.keys(visibleFilters).map(filter => (
<ListItem key={filter} sx={{padding: '0px 0px'}}>
<FormControlLabel
control={
<Checkbox
checked={
visibleFilters[filter as keyof typeof visibleFilters]
}
onChange={handleFilterVisibilityChange}
name={filter}
/>
}
label={filter.charAt(0).toUpperCase() + filter.slice(1)}
/>
</ListItem>
))}
</List>
</DialogContent>
<DialogActions>
<Box sx={{flexGrow: 1}}>
<Button
onClick={onRestoreDefaults}
color="primary"
disabled={isDefaultState}
>
RESTORE DEFAULT
</Button>
</Box>
<Box>
<Button onClick={onClose} color="primary">
CANCEL
</Button>
<Button onClick={onApply} color="primary">
APPLY
</Button>
</Box>
</DialogActions>
</Dialog>
)
}
export default CustomizeDialog