import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import {MdContentCopy, MdVisibility, MdVisibilityOff, MdDelete} from 'react-icons/md' import LayerIcon from '../icons/LayerIcon' import {SortableElement, SortableHandle} from 'react-sortable-hoc' const DraggableLabel = SortableHandle((props) => { return
{props.layerId}
}); class IconAction extends React.Component { static propTypes = { action: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, wdKey: PropTypes.string, classBlockName: PropTypes.string, classBlockModifier: PropTypes.string, } renderIcon() { switch(this.props.action) { case 'duplicate': return case 'show': return case 'hide': return case 'delete': return } } render() { const {classBlockName, classBlockModifier} = this.props; let classAdditions = ''; if (classBlockName) { classAdditions = `maputnik-layer-list-icon-action__${classBlockName}`; if (classBlockModifier) { classAdditions += ` maputnik-layer-list-icon-action__${classBlockName}--${classBlockModifier}`; } } return } } class LayerListItem extends React.Component { static propTypes = { layerId: PropTypes.string.isRequired, layerType: PropTypes.string.isRequired, isSelected: PropTypes.bool, visibility: PropTypes.string, className: PropTypes.string, onLayerSelect: PropTypes.func.isRequired, onLayerCopy: PropTypes.func, onLayerDestroy: PropTypes.func, onLayerVisibilityToggle: PropTypes.func, } static defaultProps = { isSelected: false, visibility: 'visible', onLayerCopy: () => {}, onLayerDestroy: () => {}, onLayerVisibilityToggle: () => {}, } static childContextTypes = { reactIconBase: PropTypes.object } getChildContext() { return { reactIconBase: { size: 14 } } } render() { const visibilityAction = this.props.visibility === 'visible' ? 'show' : 'hide'; return
  • this.props.onLayerSelect(this.props.layerId)} data-wd-key={"layer-list-item:"+this.props.layerId} className={classnames({ "maputnik-layer-list-item": true, "maputnik-layer-list-item-selected": this.props.isSelected, [this.props.className]: true, })}> this.props.onLayerDestroy(this.props.layerId)} /> this.props.onLayerCopy(this.props.layerId)} /> this.props.onLayerVisibilityToggle(this.props.layerId)} />
  • } } const LayerListItemSortable = SortableElement((props) => ); export default LayerListItemSortable;