mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-20 06:28:14 -04:00
* 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>
30 lines
805 B
TypeScript
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;
|
|
};
|