Files
workavia-drive/tdrive/frontend/src/app/features/dragndrop/hook/draggable.tsx
T
Greemty 5fd29bb0d6 Dragndrop feature to move a file into a folder (#138) (#148)
Co-authored-by: Anton SHEPILOV <ashepilov@linagora.com>
Co-authored-by: montaghanmy <monta.ghanmy@gmail.com>
2023-09-04 10:36:06 +02:00

22 lines
481 B
TypeScript

import React, { MouseEventHandler } from 'react';
import {useDraggable} from '@dnd-kit/core';
type DraggableProps={
children: React.ReactNode
id: number
}
export function Draggable(props:DraggableProps) {
const {attributes, listeners, setNodeRef, transform} = useDraggable({
id: `draggable-${props.id+1}`,
data: {
child: props.children
},
});
return (
<div ref={setNodeRef} {...listeners} {...attributes}>
{props.children}
</div>
);
}