import React from 'react' import classnames from 'classnames' import {MdContentCopy, MdVisibility, MdVisibilityOff, MdDelete} from 'react-icons/md' import { IconContext } from 'react-icons' import {useSortable} from '@dnd-kit/sortable' import {CSS} from '@dnd-kit/utilities' import IconLayer from './IconLayer' type DraggableLabelProps = { layerId: string layerType: string dragAttributes?: React.HTMLAttributes dragListeners?: React.HTMLAttributes }; const DraggableLabel: React.FC = (props) => { const {dragAttributes, dragListeners} = props; return
}; type IconActionProps = { action: string onClick(...args: unknown[]): unknown wdKey?: string classBlockName?: string classBlockModifier?: string }; class IconAction extends React.Component { 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 } } type LayerListItemProps = { id?: string layerIndex: number layerId: string layerType: string isSelected?: boolean visibility?: string className?: string onLayerSelect(index: number): void; onLayerCopy?(...args: unknown[]): unknown onLayerDestroy?(...args: unknown[]): unknown onLayerVisibilityToggle?(...args: unknown[]): unknown }; const LayerListItem = React.forwardRef((props, ref) => { const { isSelected = false, visibility = 'visible', onLayerCopy = () => {}, onLayerDestroy = () => {}, onLayerVisibilityToggle = () => {}, } = props; const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({id: props.layerId}); const style = { transform: CSS.Transform.toString(transform), transition, opacity: isDragging ? 0.5 : 1, }; const visibilityAction = visibility === 'visible' ? 'show' : 'hide'; // Cast ref to MutableRefObject since we know from the codebase that's what's always passed const refObject = ref as React.MutableRefObject | null; return
  • { setNodeRef(node); if (refObject) { refObject.current = node; } }} style={style} id={props.id} onClick={_e => props.onLayerSelect(props.layerIndex)} data-wd-key={"layer-list-item:" + props.layerId} className={classnames({ "maputnik-layer-list-item": true, "maputnik-layer-list-item-selected": isSelected, [props.className!]: true, })}> onLayerDestroy!(props.layerIndex)} /> onLayerCopy!(props.layerIndex)} /> onLayerVisibilityToggle!(props.layerIndex)} />
  • }); export default LayerListItem;