Show editor for selected layer

This commit is contained in:
Lukas Martinelli
2016-12-17 16:09:37 +01:00
parent f2564e4ddb
commit dc8618cf3c
3 changed files with 37 additions and 23 deletions

View File

@@ -43,9 +43,6 @@ export class LayerEditor extends React.Component {
constructor(props) {
super(props);
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
this.state = {
isOpened: false,
}
}
getChildContext () {
@@ -79,10 +76,6 @@ export class LayerEditor extends React.Component {
this.props.onLayerChanged(changedLayer)
}
toggleLayer() {
this.setState({isOpened: !this.state.isOpened})
}
layerFromType(type) {
if (type === "fill") {
return <FillLayer
@@ -143,7 +136,7 @@ export class LayerEditor extends React.Component {
borderColor: theme.borderColor,
borderLeftColor: this.props.layer.getIn(['metadata', 'maputnik:color'])
}}>
<Toolbar onClick={this.toggleLayer.bind(this)}>
<Toolbar>
<NavItem style={{fontWeight: 400}}>
#{this.props.layer.get('id')}
</NavItem>
@@ -155,11 +148,9 @@ export class LayerEditor extends React.Component {
<MdDelete />
</NavItem>
</Toolbar>
<Collapse isOpened={this.state.isOpened}>
<div style={{padding: theme.scale[2], paddingRight: 0, backgroundColor: theme.colors.black}}>
{this.layerFromType(this.props.layer.get('type'))}
</div>
</Collapse>
<div style={{padding: theme.scale[2], paddingRight: 0, backgroundColor: theme.colors.black}}>
{this.layerFromType(this.props.layer.get('type'))}
</div>
</div>
}
}