diff --git a/src/components/FileExplorer.tsx b/src/components/FileExplorer.tsx index 4307d8d..8abcc59 100644 --- a/src/components/FileExplorer.tsx +++ b/src/components/FileExplorer.tsx @@ -261,13 +261,15 @@ function ListView({ width, height, metaData, expandTo, renderNodeContext }: List useOnLocationChange(goToCurrentItem) useOnPJAXDone(goToCurrentItem) + const { compactFileTree } = useConfigs().value + return ( visibleNodes?.nodes[index]?.path} itemData={renderNodeContext} itemCount={visibleNodes.nodes.length} - itemSize={37} + itemSize={compactFileTree ? 24 : 37} height={height} width={width} > diff --git a/src/components/Node.tsx b/src/components/Node.tsx index 97adbde..42eee55 100644 --- a/src/components/Node.tsx +++ b/src/components/Node.tsx @@ -38,6 +38,7 @@ export function Node({ style, onClick, }: Props) { + const { compactFileTree: compact } = useConfigs().value return (
diff --git a/src/components/settings/FileTreeSettings.tsx b/src/components/settings/FileTreeSettings.tsx index 7068f4e..337ab54 100644 --- a/src/components/settings/FileTreeSettings.tsx +++ b/src/components/settings/FileTreeSettings.tsx @@ -83,6 +83,13 @@ export function FileTreeSettings(props: React.PropsWithChildren) { tooltip: 'Show number of comments next to file names in Pull Requests.', }} /> + ) } diff --git a/src/styles/index.scss b/src/styles/index.scss index 59c5780..b1a2931 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -649,10 +649,18 @@ $minimal-z-index: max($github-header-z-index, $github-pull-request-float-header- margin: 0; line-height: 20px; cursor: pointer; - border-bottom: 1px solid var(--gitako-border-secondary); white-space: nowrap; transition: padding 0.3s ease; // on toggle expansion in search results + border-bottom: 1px solid var(--gitako-border-secondary); + &.compact { + border-bottom: none; + &.focused { + border-top: 1px solid var(--gitako-border-secondary); + border-bottom: 1px solid var(--gitako-border-secondary); + } + } + &:not(:hover) { color: var(--gitako-text-primary); } diff --git a/src/utils/config/helper.ts b/src/utils/config/helper.ts index 20e2960..6380697 100644 --- a/src/utils/config/helper.ts +++ b/src/utils/config/helper.ts @@ -19,6 +19,7 @@ export type Config = { sidebarToggleMode: 'persistent' | 'float' commentToggle: boolean codeFolding: boolean + compactFileTree: boolean } enum configKeys { @@ -37,6 +38,7 @@ enum configKeys { sidebarToggleMode = 'sidebarToggleMode', commentToggle = 'commentToggle', codeFolding = 'codeFolding', + compactFileTree = 'compactFileTree', } export const defaultConfigs: Config = { @@ -55,6 +57,7 @@ export const defaultConfigs: Config = { sidebarToggleMode: 'float', commentToggle: true, codeFolding: true, + compactFileTree: false, } const configKeyArray = Object.values(configKeys)