maputnik/src/components/layers/LayerEditorGroup.jsx

34 lines
1 KiB
React
Raw Normal View History

2016-12-21 11:24:32 +01:00
import React from 'react'
import PropTypes from 'prop-types'
2017-01-11 17:52:21 +01:00
import Collapser from './Collapser'
import CollapseReducedMotion from './CollapseReducedMotion'
2016-12-21 11:24:32 +01:00
export default class LayerEditorGroup extends React.Component {
static propTypes = {
"data-wd-key": PropTypes.string,
title: PropTypes.string.isRequired,
isActive: PropTypes.bool.isRequired,
children: PropTypes.element.isRequired,
onActiveToggle: PropTypes.func.isRequired
2016-12-21 11:24:32 +01:00
}
render() {
2016-12-21 11:27:49 +01:00
return <div>
2017-01-10 21:28:30 +01:00
<div className="maputnik-layer-editor-group"
data-wd-key={"layer-editor-group:"+this.props["data-wd-key"]}
2016-12-21 11:27:49 +01:00
onClick={e => this.props.onActiveToggle(!this.props.isActive)}
>
2016-12-21 11:24:32 +01:00
<span>{this.props.title}</span>
<span style={{flexGrow: 1}} />
<Collapser isCollapsed={this.props.isActive} />
</div>
<CollapseReducedMotion isActive={this.props.isActive}>
<div className="react-collapse-container">
{this.props.children}
</div>
</CollapseReducedMotion>
2016-12-21 11:24:32 +01:00
</div>
}
}