fix: fold indent style

This commit is contained in:
Joel
2026-01-19 16:33:25 +08:00
parent d3d1ba2488
commit bd070857ed
2 changed files with 12 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ const FilePickerTreeNode: FC<FilePickerTreeNodeProps> = ({ node, style, dragHand
onClick={handleClick}
onKeyDown={handleKeyDown}
>
<TreeGuideLines level={node.level} />
<TreeGuideLines level={node.level} lineOffset={0} />
<div className="flex min-w-0 flex-1 items-center gap-2 px-3">
<div className="flex size-4 shrink-0 items-center justify-center">
{isFolder

View File

@@ -2,13 +2,20 @@
import * as React from 'react'
const INDENT_SIZE = 20
type TreeGuideLinesProps = {
level: number
indentSize?: number
lineOffset?: number
}
const TreeGuideLines: React.FC<TreeGuideLinesProps> = ({ level }) => {
const INDENT_SIZE = 20
const DEFAULT_LINE_OFFSET = 10
const TreeGuideLines: React.FC<TreeGuideLinesProps> = ({
level,
indentSize = INDENT_SIZE,
lineOffset = DEFAULT_LINE_OFFSET,
}) => {
if (level === 0)
return null
@@ -18,7 +25,7 @@ const TreeGuideLines: React.FC<TreeGuideLinesProps> = ({ level }) => {
<div
key={`guide-${i}`}
className="absolute bottom-0 top-0 border-l border-divider-subtle"
style={{ left: `${(i + 1) * INDENT_SIZE - 10}px` }}
style={{ left: `${(i + 1) * indentSize - lineOffset}px` }}
/>
))}
</>