@e-group/material-module
Version:
EGroup Team react component modules.
43 lines (38 loc) • 1.32 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React from 'react';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core';
import DragIcon from '../DragIcon';
const useStyles = makeStyles(theme => ({
root: {
width: '100%',
cursor: props => !props.disabled ? 'move' : undefined,
display: 'flex',
alignItems: 'center',
height: theme.spacing(3)
},
dragIcon: {
margin: 'auto',
transform: 'rotate(90deg)',
color: theme.egPalette.text[2]
}
}));
const QuestionDragHandle = props => {
const classes = useStyles(props);
const className = props.className,
disabled = props.disabled,
DragHandleProps = props.DragHandleProps,
other = _objectWithoutProperties(props, ["className", "disabled", "DragHandleProps"]);
if (disabled) {
return /*#__PURE__*/React.createElement("div", _extends({
className: clsx(className, classes.root)
}, DragHandleProps, other));
}
return /*#__PURE__*/React.createElement("div", _extends({
className: clsx(className, classes.root)
}, DragHandleProps, other), /*#__PURE__*/React.createElement(DragIcon, {
className: classes.dragIcon
}));
};
export default QuestionDragHandle;