Skip to content

Commit 4b0a4dd

Browse files
feat: add visual indentation guide
fix #213
1 parent f5308c6 commit 4b0a4dd

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/webview/SearchSidebar/SearchResultList/TreeItem.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ const styles = stylex.create({
1111
treeItem: {
1212
position: 'relative',
1313
background: 'var(--vscode-sideBar-background)',
14+
'::before': {
15+
content: '',
16+
display: 'block',
17+
position: 'absolute',
18+
top: '22px',
19+
bottom: 0,
20+
left: '13px', // left 16px - translateX 3px
21+
width: '1px',
22+
backgroundColor: 'var(--vscode-tree-inactiveIndentGuidesStroke)',
23+
transition: '0.1s opacity linear',
24+
},
1425
},
1526
fileName: {
1627
position: 'sticky',

src/webview/SearchSidebar/SearchResultList/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
import { memo } from 'react'
22
import { DisplayResult } from '../../../types'
33
import TreeItem from './TreeItem'
4+
import * as stylex from '@stylexjs/stylex'
5+
6+
const styles = stylex.create({
7+
resultList: {
8+
flexGrow: 1,
9+
overflowY: 'scroll',
10+
':not(:hover) > div::before': {
11+
opacity: 0,
12+
},
13+
':hover > div::before': {
14+
opacity: 1,
15+
},
16+
},
17+
})
418

519
interface SearchResultListProps {
620
matches: Array<[string, DisplayResult[]]>
721
}
822

923
const SearchResultList = ({ matches }: SearchResultListProps) => {
1024
return (
11-
<div style={{ flexGrow: '1', overflowY: 'scroll' }}>
25+
<div {...stylex.props(styles.resultList)}>
1226
{matches.map(([filePath, match]) => {
1327
return <TreeItem filePath={filePath} matches={match} key={filePath} />
1428
})}

0 commit comments

Comments
 (0)