forked from visgl/deck.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayer-selector.js
More file actions
58 lines (55 loc) · 1.57 KB
/
Copy pathlayer-selector.js
File metadata and controls
58 lines (55 loc) · 1.57 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
47
48
49
50
51
52
53
54
55
56
57
58
/* eslint-disable no-unused-vars */
import React from 'react';
/* eslint-enable no-unused-vars */
function renderExampleButtons({examples, activeExamples, onChange}) {
const children = [];
for (const exampleName of Object.keys(examples)) {
children.push(
<div key={ exampleName } className="checkbox"
style={{pointerEvents: 'auto'}}>
<input
type="checkbox"
id={exampleName}
name="layerStatus"
value={exampleName || ''}
checked={activeExamples[exampleName] || ''}
onChange={e => onChange(exampleName)}
/>
<label htmlFor={ exampleName } style={{display: 'inline-block'}}>
<div style={{marginLeft: 30, whiteSpace: 'nowrap'}}>
{ exampleName }
</div>
</label>
</div>
);
}
return children;
}
function renderExampleCategories({examples, activeExamples, onChange}) {
const children = [];
for (const categoryName of Object.keys(examples)) {
const category = examples[categoryName];
children.push(
<div key={categoryName}>
<h4>{ categoryName }</h4>
{ renderExampleButtons({examples: category, activeExamples, onChange}) }
</div>
);
}
return children;
}
export default function LayerSelector({examples, activeExamples, onChange}) {
return (
<div id="example-selector" style={{
padding: 0,
width: 270,
height: '100%',
overflowX: 'hidden',
overflowY: 'scroll'
}}>
{
renderExampleCategories({examples, activeExamples, onChange})
}
</div>
);
}