-
Notifications
You must be signed in to change notification settings - Fork 32
/
MapLayers.js
45 lines (42 loc) 路 1.05 KB
/
MapLayers.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
import React from "react";
import PropTypes from "prop-types";
export default function MapLayers({ children }) {
return (
<table>
<thead>
<tr>
<th>Group</th>
<th>Name</th>
<th>Active</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
{React.Children.map(children, (element) => (
<MapLayer element={element} />
))}
</tbody>
</table>
);
}
MapLayers.propTypes = {
children: PropTypes.node,
};
export function MapLayer({ element }) {
if (!element || !element.type) {
return null;
}
const type = element.type.isAutoBasemap ? "Basemap" : "Overlay",
{ name, active } = element.props;
return (
<tr>
<td>{type}</td>
<td>{name}</td>
<td>{active ? "Y" : "N"}</td>
<td>{element}</td>
</tr>
);
}
MapLayer.propTypes = {
element: PropTypes.node,
};