Files
spacedrive/interface/app/$libraryId/Explorer/ViewContext.ts
ameer2468 6ac58a312f [ENG-1142] Path bar shortcut (#1377)
* Path bar shortcut

* Add option to popover and tweak UI

* increase size of folder icon + frame thumbs

* view adjustments

* truncate

---------

Co-authored-by: nikec <nikec.job@gmail.com>
2023-09-27 14:49:01 +00:00

30 lines
805 B
TypeScript

import { createContext, useContext, type ReactNode, type RefObject } from 'react';
import { ExplorerViewPadding } from './View';
export interface ExplorerViewContext {
ref: RefObject<HTMLDivElement>;
top?: number;
bottom?: number;
contextMenu?: ReactNode;
setIsContextMenuOpen?: (isOpen: boolean) => void;
isRenaming: boolean;
setIsRenaming: (isRenaming: boolean) => void;
padding?: Omit<ExplorerViewPadding, 'x' | 'y'>;
gap?: number | { x?: number; y?: number };
selectable: boolean;
listViewOptions?: {
hideHeaderBorder?: boolean;
};
}
export const ViewContext = createContext<ExplorerViewContext | null>(null);
export const useExplorerViewContext = () => {
const ctx = useContext(ViewContext);
if (ctx === null) throw new Error('ViewContext.Provider not found!');
return ctx;
};