Highlight root folder as drop target for external files (#15027)

GitOrigin-RevId: 2ef13ec9f167c39c7144ca90059a17e2a7c6e0b9
This commit is contained in:
Alf Eaton 2023-10-02 11:26:25 +01:00 committed by Copybot
parent b3b31fb052
commit 9098d6fba7
2 changed files with 10 additions and 12 deletions

View file

@ -16,14 +16,6 @@ function FileTreeDraggablePreviewLayer({ isOver }) {
}))
const ref = useRef()
const containerOffset = ref.current
? ref.current.getBoundingClientRect()
: null
if (!isDragging || !item.title) {
return null
}
return (
<div
ref={ref}
@ -31,9 +23,16 @@ function FileTreeDraggablePreviewLayer({ isOver }) {
'dnd-droppable-hover': isOver,
})}
>
<div style={getItemStyle(clientOffset, containerOffset)}>
<DraggablePreviewItem title={item.title} />
</div>
{isDragging && item?.title && (
<div
style={getItemStyle(
clientOffset,
ref.current?.getBoundingClientRect()
)}
>
<DraggablePreviewItem title={item.title} />
</div>
)}
</div>
)
}

View file

@ -75,7 +75,6 @@ function FileTreeRootFolder() {
files={fileTreeData.fileRefs}
classes={{ root: 'file-tree-list' }}
dropRef={dropRef}
isOver={isOver}
dataTestId="file-tree-list-root"
/>
</>