mirror of
https://github.com/maputnik/editor.git
synced 2026-06-09 08:47:26 +00:00
Added classBlockModifier to <LayerAction/> and switched to only displaying icons for hidden layers
This commit is contained in:
@@ -33,6 +33,7 @@ class IconAction extends React.Component {
|
|||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
wdKey: PropTypes.string,
|
wdKey: PropTypes.string,
|
||||||
classBlockName: PropTypes.string,
|
classBlockName: PropTypes.string,
|
||||||
|
classBlockModifier: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
renderIcon() {
|
renderIcon() {
|
||||||
@@ -45,9 +46,15 @@ class IconAction extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const {classBlockName, classBlockModifier} = this.props;
|
||||||
|
|
||||||
let classAdditions = '';
|
let classAdditions = '';
|
||||||
if (this.props.classBlockName) {
|
if (classBlockName) {
|
||||||
classAdditions = `maputnik-layer-list-icon-action__${this.props.classBlockName}`;
|
classAdditions = `maputnik-layer-list-icon-action__${classBlockName}`;
|
||||||
|
|
||||||
|
if (classBlockModifier) {
|
||||||
|
classAdditions += ` maputnik-layer-list-icon-action__${classBlockName}--${classBlockModifier}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <button
|
return <button
|
||||||
@@ -96,6 +103,8 @@ class LayerListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const visibilityAction = this.props.visibility === 'visible' ? 'show' : 'hide';
|
||||||
|
|
||||||
return <li
|
return <li
|
||||||
key={this.props.layerId}
|
key={this.props.layerId}
|
||||||
onClick={e => this.props.onLayerSelect(this.props.layerId)}
|
onClick={e => this.props.onLayerSelect(this.props.layerId)}
|
||||||
@@ -122,8 +131,9 @@ class LayerListItem extends React.Component {
|
|||||||
/>
|
/>
|
||||||
<IconAction
|
<IconAction
|
||||||
wdKey={"layer-list-item:"+this.props.layerId+":toggle-visibility"}
|
wdKey={"layer-list-item:"+this.props.layerId+":toggle-visibility"}
|
||||||
action={this.props.visibility === 'visible' ? 'show' : 'hide'}
|
action={visibilityAction}
|
||||||
classBlockName="visibility"
|
classBlockName="visibility"
|
||||||
|
classBlockModifier={visibilityAction}
|
||||||
onClick={e => this.props.onLayerVisibilityToggle(this.props.layerId)}
|
onClick={e => this.props.onLayerVisibilityToggle(this.props.layerId)}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.maputnik-layer-list-icon-action__visibility {
|
.maputnik-layer-list-icon-action__visibility--hide {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user