@@ -78,17 +78,21 @@ function SideBar({ favorites, openFSObject, currentPath }: SideBarProps) {
7878}
7979
8080interface MainContentProps {
81- diContents : Record < string , FSObject > ;
81+ dirContents : Record < string , FSObject > ;
8282 openFSObject : ( fsObject : FSObject ) => void ;
8383}
8484
85- function MainContent ( { diContents, openFSObject } : MainContentProps ) {
85+ function MainContent ( { dirContents, openFSObject } : MainContentProps ) {
86+ const [ selected , setSelected ] = useState < string > ( "" ) ;
8687 return (
8788 < div className = "file-browser__main-content" >
88- { Object . values < FSObject > ( diContents ) . map ( ( fsObject ) => (
89+ { Object . values < FSObject > ( dirContents ) . map ( ( fsObject ) => (
8990 < div
90- className = "file-browser__main-content__item"
91+ className = { `file-browser__main-content__item ${
92+ fsObject . path === selected ? "active" : ""
93+ } `}
9194 onDoubleClick = { ( ) => openFSObject ( fsObject ) }
95+ onClick = { ( ) => setSelected ( fsObject . path ) }
9296 key = { fsObject . path }
9397 >
9498 { isFSDirectory ( fsObject ) ? (
@@ -141,7 +145,7 @@ function FileBrowser({ path = defaultPath }: FileBrowserProps) {
141145 />
142146
143147 < MainContent
144- diContents = { fs . currentDirectory . contents }
148+ dirContents = { fs . currentDirectory . contents }
145149 openFSObject = { fs . navToObject }
146150 />
147151 < div className = "file-browser__bottom-bar" > </ div >
0 commit comments