-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
56 lines (52 loc) · 1.57 KB
/
index.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 Filter from './Filter';
import Search from './Search';
import Hierarchy from './Hierarchy';
import styles from './index.module.scss';
import Button from '../Button';
import logo from './deneir-logo.svg';
import { getConfig } from '../../services/read-config';
export default function LeftPanel(props) {
const hierarchy = getConfig('hierarchy');
const {
actions, groupedNodes, groupLevel, availableFilters, filters,
} = props;
return (
<div className={styles.LeftPanelContainer}>
<h1 className={styles.logo}>
<img src={logo} alt="DENEIR" />
</h1>
<Search nodes={groupedNodes} />
{hierarchy && (
<Hierarchy
hierarchy={hierarchy}
groupLevel={groupLevel}
setGroupLevel={actions.setGroupLevel}
/>
)}
{Object.keys(availableFilters).map((filterId) => (
<Filter
key={filterId}
filters={filters[filterId]}
filterId={filterId}
values={availableFilters[filterId]}
onChange={actions.handleFilterChange}
/>
))}
{Object.keys(filters).length > 0 && (
<div className={styles.clearFilterWrapper}>
<Button type="button" onClick={actions.handleResetFilters}>Clear filters</Button>
</div>
)}
</div>
);
}
LeftPanel.propTypes = {
actions: PropTypes.object,
groupedNodes: PropTypes.object,
groupLevel: PropTypes.string,
neighbourLevel: PropTypes.number,
availableFilters: PropTypes.object,
filters: PropTypes.object,
};