mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
add icon for search item, add repo_name for link-content (#2803)
* add icon for search item, add repo_name for link-content * improve search module
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { siteRoot } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
item: PropTypes.object.isRequired,
|
||||
@@ -15,11 +17,16 @@ class SearchResultItem extends React.Component {
|
||||
|
||||
render() {
|
||||
let item = this.props.item;
|
||||
let fileIconSize = Utils.isHiDPI() ? 48 : 24;
|
||||
let fileIconUrl = item.is_dir ? siteRoot + 'media/img/folder-192.png' : Utils.getFileIconUrl(item.name, fileIconSize);
|
||||
return (
|
||||
<li className="search-result-item" onClick={this.onClickHandler}>
|
||||
<span className="item-content item-name">{item.name}</span>
|
||||
<span className="item-content item-link">{item.link_content}</span>
|
||||
<div className="item-content item-text" dangerouslySetInnerHTML={{__html: item.content}}></div>
|
||||
<img className="item-img" src={fileIconUrl} alt="" />
|
||||
<div className="item-content">
|
||||
<dt className="item-name ellipsis">{item.name}</dt>
|
||||
<dd className="item-link ellipsis">{item.repo_name}/{item.link_content}</dd>
|
||||
<dd className="item-text ellipsis" dangerouslySetInnerHTML={{__html: item.content}}></dd>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user