-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve recently used item list ui * update view in recently used from repo list to folder list
- Loading branch information
1 parent
093d8b1
commit 3747b8a
Showing
5 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
frontend/src/components/file-chooser/recently-used-list-item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
|
||
const RecentlyUsedListItem = ({ path, isSelected, onItemClick }) => { | ||
const title = path.split('/').pop(); | ||
|
||
const handleItemClick = () => { | ||
onItemClick(path); | ||
}; | ||
|
||
return ( | ||
<li> | ||
<div className={`${isSelected ? 'item-active' : ''} item-info recently-used`} onClick={handleItemClick}> | ||
<div className="item-left-icon"> | ||
<i className="tree-node-icon"> | ||
<span className="icon sf3-font sf3-font-folder tree-node-icon"></span> | ||
</i> | ||
</div> | ||
<div className="item-text"> | ||
<span className="name user-select-none ellipsis" title={title}>{title}</span> | ||
</div> | ||
</div> | ||
</li> | ||
); | ||
}; | ||
|
||
export default RecentlyUsedListItem; |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/file-chooser/recently-used-list-view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useState } from 'react'; | ||
import RecentlyUsedListItem from './recently-used-list-item'; | ||
|
||
const RecentlyUsedListView = ({ recentlyUsedList, selectedRepo, onDirentItemClick }) => { | ||
const [selectedItem, setSelectedItem] = useState(null); | ||
|
||
const onItemClick = (path) => { | ||
setSelectedItem(path); | ||
onDirentItemClick(selectedRepo, path); | ||
}; | ||
|
||
return ( | ||
<ul className="list-view-content file-chooser-item" > | ||
{recentlyUsedList.length > 0 && recentlyUsedList.map((path, index) => { | ||
return ( | ||
<RecentlyUsedListItem | ||
key={index} | ||
path={path} | ||
isSelected={selectedItem === path} | ||
onItemClick={onItemClick} | ||
/> | ||
); | ||
})} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default RecentlyUsedListView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters