maputnik/src/components/layers/LayerListGroup.jsx

29 lines
897 B
React
Raw Normal View History

2017-01-11 17:52:21 +01:00
import React from 'react'
import PropTypes from 'prop-types'
2017-01-11 17:52:21 +01:00
import Collapser from './Collapser'
export default class LayerListGroup extends React.Component {
2017-01-11 17:52:21 +01:00
static propTypes = {
title: PropTypes.string.isRequired,
"data-wd-key": PropTypes.string,
isActive: PropTypes.bool.isRequired,
onActiveToggle: PropTypes.func.isRequired
2017-01-11 17:52:21 +01:00
}
render() {
return <li className="maputnik-layer-list-group">
2017-01-11 17:52:21 +01:00
<div className="maputnik-layer-list-group-header"
data-wd-key={"layer-list-group:"+this.props["data-wd-key"]}
2017-01-11 17:52:21 +01:00
onClick={e => this.props.onActiveToggle(!this.props.isActive)}
>
<span className="maputnik-layer-list-group-title">{this.props.title}</span>
<span className="maputnik-space" />
<Collapser
style={{ height: 14, width: 14 }}
isCollapsed={this.props.isActive}
/>
</div>
</li>
2017-01-11 17:52:21 +01:00
}
}