Files
spacedrive/interface/app/$libraryId/Explorer/View/DragScrollable.tsx
nikec caf4fc5cde [ENG-1353] explorer dnd (#1737)
* locations dnd

* fix icon

* reduce navigate timeout

* fix types

* another

* fix drag overlay count

* Update pnpm-lock.yaml

* merge

* ephemeral support and other improvements

* merge

* Tag dnd

* merge

* type

* merge

* remove offset

* update dnd logic to not depend on drag source

* handle allowed types if parent isn't available

* saved searches dnd navigation

* well

* rendering

* Update pnpm-lock.yaml

* types

* remove width

* Temporary solution

* merge

* @dnd-kit/utilities

* Update pnpm-lock.yaml

* explorer path dnd

* remove unused drag hook

* fix dnd on LayeredFileIcon

---------

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2023-12-13 11:59:27 +00:00

34 lines
1.1 KiB
TypeScript

import { useExplorerLayoutStore } from '@sd/client';
import { tw } from '@sd/ui';
import { useTopBarContext } from '../../TopBar/Layout';
import { useExplorerContext } from '../Context';
import { PATH_BAR_HEIGHT } from '../ExplorerPath';
import { useDragScrollable } from './useDragScrollable';
const Trigger = tw.div`absolute inset-x-0 h-10 pointer-events-none`;
export const DragScrollable = () => {
const topBar = useTopBarContext();
const explorer = useExplorerContext();
const explorerSettings = explorer.useSettingsSnapshot();
const layoutStore = useExplorerLayoutStore();
const showPathBar = explorer.showPathBar && layoutStore.showPathBar;
const { ref: dragScrollableUpRef } = useDragScrollable({ direction: 'up' });
const { ref: dragScrollableDownRef } = useDragScrollable({ direction: 'down' });
return (
<>
{explorerSettings.layoutMode !== 'list' && (
<Trigger ref={dragScrollableUpRef} style={{ top: topBar.topBarHeight }} />
)}
<Trigger
ref={dragScrollableDownRef}
style={{ bottom: showPathBar ? PATH_BAR_HEIGHT : 0 }}
/>
</>
);
};