1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +00:00

Merge pull request #3606 from haiwen/modify_choose_style

modify choose style
This commit is contained in:
Daniel Pan
2019-06-03 18:16:35 +08:00
committed by GitHub
3 changed files with 51 additions and 29 deletions

View File

@@ -120,7 +120,8 @@ class RepoListItem extends React.Component {
});
}
onToggleClick = () => {
onToggleClick = (e) => {
e.stopPropagation();
this.setState({isShowChildren: !this.state.isShowChildren});
}
@@ -150,12 +151,18 @@ class RepoListItem extends React.Component {
}
return (
<li className="file-chooser-item">
<span className={`item-toggle fa ${this.state.isShowChildren ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
<span className={`item-info ${repoActive ? 'item-active' : ''}`} onClick={this.onRepoItemClick}>
<span className="icon far fa-folder"></span>
<span className="name user-select-none ellipsis">{this.props.repo.repo_name}</span>
</span>
<li>
<div className={`${repoActive ? 'item-active' : ''} item-info`} onClick={this.onRepoItemClick}>
<div className="item-text">
<span className="name user-select-none ellipsis">{this.props.repo.repo_name}</span>
</div>
<div className="item-left-icon">
<span className={`item-toggle icon fa ${this.state.isShowChildren ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
<i className="tree-node-icon">
<span className="icon far fa-folder tree-node-icon"></span>
</i>
</div>
</div>
{this.state.isShowChildren && (
<TreeListView
repo={this.props.repo}

View File

@@ -89,14 +89,20 @@ class TreeViewItem extends React.Component {
return(
<div className="file-chooser-item">
<div className={`${node.path === '/'? 'hide': ''}`}>
<div className={`${(isCurrentRepo && isCurrentPath) ? 'item-active' : ''} item-info`} onClick={this.onItemClick}>
<div className="item-text">
<span className="name user-select-none ellipsis">{node.object && node.object.name}</span>
</div>
<div className="item-left-icon">
{
node.object.type !== 'file' &&
<span className={`item-toggle fa ${node.isExpanded ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
<span className={`icon item-toggle fa ${node.isExpanded ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
}
<span className={`item-info ${(isCurrentRepo && isCurrentPath) ? 'item-active' : ''}`} onClick={this.onItemClick}>
<span className={`icon far ${node.object.type === 'dir' ? 'fa-folder' : 'fa-file'}`}></span>
<span className="name user-select-none ellipsis">{node.object && node.object.name}</span>
</span>
<i className="tree-node-icon">
<span className={`icon far ${node.object.type === 'dir' ? 'fa-folder' : 'fa-file'}`}></span>
</i>
</div>
</div>
</div>
{node.isExpanded && this.renderChildren()}
</div>

View File

@@ -42,36 +42,27 @@
.file-chooser-item {
position: relative;
padding-left: 1.5rem;
padding-left: 22px;
}
.file-chooser-item .item-info {
display: flex;
height: 1.5rem;
cursor: pointer;
padding: 0;
}
.file-chooser-item .item-info:hover {
background: #FDEFB9;
border-radius: 2px;
box-shadow: inset 0 0 1px #999;
position: relative;
line-height: 1.625;
}
.file-chooser-item .item-active {
background: #F3AF7D !important;
border-radius: 2px;
box-shadow: inset 0 0 1px #999;
color: #fff
color: #fff;
}
.file-chooser-item .item-info .icon {
display: flex;
justify-content: center;
align-items: center;
color: #b0b0b0;
width: 1.5rem;
height: 1.5rem;
.file-chooser-item .item-info:hover {
background: #FDEFB9;
border-radius: 2px;
box-shadow: inset 0 0 1px #999;
}
.file-chooser-item .item-info .name {
@@ -132,6 +123,24 @@
border-bottom: 1px solid rgba(0, 0, 0, 0);
}
.item-text {
padding-left: 2.8rem;
font-size: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 24px;
}
.item-left-icon {
position: absolute;
display: flex;
align-items: center;
top: 0;
left: 0;
padding-left: 1.5rem;
}