/
index.tsx
49 lines (42 loc) · 1.03 KB
/
index.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
/**
* @module components/ColorFacet
*/
import MapArray from 'components/common/MapArray';
import Item from 'components/ColorFacet/Item';
import { ThemedSFCProps, MJSConfiguration, IFacetValue, IFacet } from 'types';
import { List } from 'immutable';
import styles from 'components/ColorFacet/styles.css';
export interface IColorFacetProps extends ThemedSFCProps {
/** MJS Configuration */
config: MJSConfiguration;
/** Facet values to render */
items: List<IFacetValue>;
facet: IFacet;
hidden: boolean;
isMobile?: boolean;
}
export default ({
facet,
hidden,
theme = styles,
isMobile,
config,
}: IColorFacetProps) => {
const mapping = config.get('colorMapping');
return (
<div
className={theme.root}
id={`facet-${facet.get('name')}`}
role="region"
hidden={hidden}
>
<MapArray
config={config}
array={facet.get('values').filter((i) => mapping.has(i.get('value')))}
factory={Item}
theme={theme}
isMobile={isMobile}
/>
</div>
);
};