mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
fix search file when move file or dirent (#6480)
* fix search file when move file or dirent * change style * change style
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
@@ -41,16 +42,23 @@ class SearchedListItem extends React.Component {
|
||||
let { item, currentItem } = this.props;
|
||||
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(false);
|
||||
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name);
|
||||
let trClass = this.state.highlight ? 'tr-highlight' : '';
|
||||
if (currentItem) {
|
||||
if (item.repo_id === currentItem.repo_id && item.path === currentItem.path) {
|
||||
trClass = 'tr-active';
|
||||
}
|
||||
}
|
||||
return (
|
||||
<tr className={trClass} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} onDoubleClick={this.searchItemDoubleClick}>
|
||||
<td className="text-center"><img className="item-img" src={fileIconUrl} alt="" width="24"/></td>
|
||||
<td><span className="item-link">{item.repo_name}/{item.link_content}</span></td>
|
||||
<tr
|
||||
className={classnames('searched-list-item', {
|
||||
'tr-highlight': this.state.highlight,
|
||||
'tr-active': currentItem && item.repo_id === currentItem.repo_id && item.path === currentItem.path
|
||||
})}
|
||||
onClick={this.onClick}
|
||||
onMouseEnter={this.onMouseEnter}
|
||||
onMouseLeave={this.onMouseLeave}
|
||||
onDoubleClick={this.searchItemDoubleClick}
|
||||
>
|
||||
<td className="text-center">
|
||||
<img className="item-img" src={fileIconUrl} alt="" width="24"/>
|
||||
</td>
|
||||
<td>
|
||||
<span className="item-link">{item.repo_name}/{item.link_content}</span>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user