Files
oxygen-ui/src/components/dnd/DragHandle.tsx
FatttSnake 7b61a5fdb3 Feat(Menu): Add tool menu via drag and drop
Drag and drop a tool card to add tool menu
2024-04-30 13:42:36 +08:00

28 lines
757 B
TypeScript

import { HandleContextInst } from '@/components/dnd/HandleContext'
import Icon from '@ant-design/icons'
import '@/assets/css/components/dnd/drag-handle.scss'
interface DragHandleProps {
padding?: string | number
}
const DragHandle = ({ padding }: DragHandleProps) => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const { attributes, listeners, ref } = useContext(HandleContextInst)
return (
<button
data-component={'component-drag-handle'}
style={{ padding }}
ref={ref}
className={'drag-handle'}
{...attributes}
{...listeners}
>
<Icon component={IconOxygenHandle} />
</button>
)
}
export default DragHandle