Skip to content

Commit

Permalink
change mouse enter logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 committed Oct 11, 2023
1 parent 7c15775 commit 716efbd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions frontend/src/components/search/search-result-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { Utils } from '../../utils/utils';
const propTypes = {
item: PropTypes.object.isRequired,
onItemClickHandler: PropTypes.func.isRequired,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
isHighlight: PropTypes.bool,
};

Expand All @@ -31,8 +29,6 @@ class SearchResultItem extends React.Component {
<li
className={classnames('search-result-item', {'search-result-item-highlight': this.props.isHighlight })}
onClick={this.onClickHandler}
onMouseEnter={this.props.onMouseEnter}
onMouseLeave={this.props.onMouseLeave}
>
<img className={item.link_content ? 'item-img' : 'lib-item-img'} src={fileIconUrl} alt="" />
<div className="item-content">
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ class Search extends Component {
key={index}
item={item}
onItemClickHandler={this.onItemClickHandler}
onMouseEnter={(e) => this.setState({ highlightIndex: index })}
onMouseLeave={(e) => this.setState({ highlightIndex: -1 })}
isHighlight={index === highlightIndex}
/>
);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
border-radius: 4px;
}

.search-result-container .search-result-item:hover,
.search-result-container .search-result-item.search-result-item-highlight {
background-color: #f0f0f0;
}
Expand Down

0 comments on commit 716efbd

Please sign in to comment.