-
Notifications
You must be signed in to change notification settings - Fork 3
/
panel.js
56 lines (50 loc) · 1.67 KB
/
panel.js
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
import React from 'react';
import PropTypes from 'prop-types';
import useToggle from 'react-use/lib/useToggle';
import { withTheme } from '@material-ui/core/styles';
import IconButton from '@material-ui/core/IconButton';
import Drawer from '@material-ui/core/Drawer';
import IconFa from '../../../../components/iconfa';
import FilterChooser from './chooser';
function FilterPanel({ supportedTxs, onApplyFilter, selectedTxs, theme }) {
const [open, toggle] = useToggle(false);
const onToggle = () => toggle();
return (
<React.Fragment>
<IconButton onClick={onToggle} className="filter-trigger">
<IconFa name="filter" size={18} color={open ? theme.colors.gray : theme.colors.minor} />
</IconButton>
<Drawer
anchor="right"
open={open}
onClose={onToggle}
PaperProps={{
style: {
boxShadow: `-2px 16px 10px 0 rgba(0, 0, 0, ${theme.mode === 'light' ? 0.05 : 0.5})`,
backgroundColor: theme.palette.background.default,
width: '350px',
},
}}
ModalProps={{
hideBackdrop: false,
BackdropProps: {
invisible: true,
},
}}>
<FilterChooser
onClose={onToggle}
onApplyFilter={onApplyFilter}
supportedTxs={supportedTxs}
selectedTxs={selectedTxs}
/>
</Drawer>
</React.Fragment>
);
}
FilterPanel.propTypes = {
supportedTxs: PropTypes.arrayOf(PropTypes.string).isRequired,
onApplyFilter: PropTypes.func.isRequired,
selectedTxs: PropTypes.arrayOf(PropTypes.string).isRequired,
theme: PropTypes.object.isRequired,
};
export default withTheme()(FilterPanel);