Skip to content

Commit d257326

Browse files
committed
drag and drop feature
1 parent a7aeae1 commit d257326

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/components/folder-tree.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,20 @@ function FolderTree(treeProps: TreeProps) {
520520
}
521521
}
522522

523+
/**
524+
* Cursor component for rendering the cursor position
525+
* @param param0
526+
* @returns
527+
*/
528+
function Cursor({ top, left }: { top: number; left: number }) {
529+
return (
530+
<div
531+
className="absolute w-full h-0 border-dashed border-t-2 bg-mountain-mist-500 dark:bg-mountain-mist-300"
532+
style={{top, left,}}
533+
/>
534+
);
535+
}
536+
523537
return (
524538
<div className="flex flex-col gap-1">
525539
{treeProps.isHeader && (
@@ -542,13 +556,11 @@ function FolderTree(treeProps: TreeProps) {
542556
width={width}
543557
height={height}
544558
rowHeight={24}
545-
renderCursor={() => 'default'}
559+
renderCursor={Cursor}
546560
openByDefault={false}
547561
initialOpenState={{ root: true }}
548562
paddingBottom={32}
549563
disableEdit={(data) => data.isReadOnly}
550-
disableDrag={true}
551-
disableDrop={true}
552564
onDelete={onDelete}
553565
onRename={onRename}
554566
onSelect={onSelected}

0 commit comments

Comments
 (0)