mirror of
https://github.com/xuquan-nikkkki/FolderFile-Splitter-Plugin.git
synced 2026-07-22 05:37:28 +00:00
style: disable hover indent for pinned folders
This commit is contained in:
parent
4347aa7907
commit
d1c7d9a5ae
3 changed files with 15 additions and 5 deletions
|
|
@ -13,12 +13,14 @@ type Props = FolderProps & {
|
|||
onOpenFilesPane: () => void;
|
||||
disableDrag?: boolean;
|
||||
hideExpandIcon?: boolean;
|
||||
disableHoverIndent?: boolean;
|
||||
};
|
||||
const Folder = ({
|
||||
folder,
|
||||
onOpenFilesPane,
|
||||
hideExpandIcon = false,
|
||||
disableDrag = false,
|
||||
disableHoverIndent = false,
|
||||
}: Props) => {
|
||||
const { useExplorerStore } = useExplorer();
|
||||
|
||||
|
|
@ -108,10 +110,14 @@ const Folder = ({
|
|||
)}
|
||||
ref={setDropRef}
|
||||
onClick={() => setFocusedFolder(folder)}
|
||||
style={{
|
||||
marginInlineStart: -17 * folderLevel,
|
||||
paddingInlineStart: 24 + 17 * folderLevel,
|
||||
}}
|
||||
style={
|
||||
disableHoverIndent
|
||||
? undefined
|
||||
: {
|
||||
marginInlineStart: -17 * folderLevel,
|
||||
paddingInlineStart: 24 + 17 * folderLevel,
|
||||
}
|
||||
}
|
||||
>
|
||||
{maybeRenderExpandIcon()}
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { useExplorer } from "src/hooks/useExplorer";
|
|||
export type FolderOptions = {
|
||||
hideExpandIcon?: boolean;
|
||||
disableDrag?: boolean;
|
||||
disableHoverIndent?: boolean;
|
||||
};
|
||||
type Props = {
|
||||
renderFolder: (folder: TFolder, options: FolderOptions) => ReactNode;
|
||||
|
|
@ -45,6 +46,7 @@ const PinnedFolders = ({ renderFolder }: Props) => {
|
|||
const options: FolderOptions = {
|
||||
hideExpandIcon: true,
|
||||
disableDrag: true,
|
||||
disableHoverIndent: true,
|
||||
};
|
||||
return folder ? renderFolder(folder, options) : null;
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ const FolderTree = ({ onOpenFilesPane = () => {} }: Props) => {
|
|||
const { hideRootFolder } = useHideRootFolder(defaultHideRootFolder);
|
||||
|
||||
const renderFolder = (folder: TFolder, options?: FolderOptions) => {
|
||||
const { hideExpandIcon, disableDrag } = options ?? {};
|
||||
const { hideExpandIcon, disableDrag, disableHoverIndent } =
|
||||
options ?? {};
|
||||
return (
|
||||
<Folder
|
||||
key={folder.path}
|
||||
|
|
@ -58,6 +59,7 @@ const FolderTree = ({ onOpenFilesPane = () => {} }: Props) => {
|
|||
hideExpandIcon={hideExpandIcon}
|
||||
disableDrag={disableDrag}
|
||||
onOpenFilesPane={onOpenFilesPane}
|
||||
disableHoverIndent={disableHoverIndent}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue