2018-09-19 01:57:17 +00:00
|
|
|
import React from 'react';
|
2018-09-29 10:32:53 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
item: PropTypes.object.isRequired,
|
|
|
|
onItemClickHandler: PropTypes.func.isRequired,
|
|
|
|
};
|
2018-08-17 04:23:55 +00:00
|
|
|
|
|
|
|
class SearchResultItem extends React.Component {
|
|
|
|
|
|
|
|
onClickHandler = () => {
|
|
|
|
var item = this.props.item;
|
2018-09-18 02:11:37 +00:00
|
|
|
this.props.onItemClickHandler(item);
|
2018-08-17 04:23:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let item = this.props.item;
|
|
|
|
return (
|
|
|
|
<li className="search-result-item" onClick={this.onClickHandler}>
|
2018-09-29 10:32:53 +00:00
|
|
|
<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>
|
2018-08-17 04:23:55 +00:00
|
|
|
</li>
|
2018-09-29 10:32:53 +00:00
|
|
|
);
|
2018-08-17 04:23:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-29 10:32:53 +00:00
|
|
|
SearchResultItem.propTypes = propTypes;
|
|
|
|
|
2018-09-18 02:11:37 +00:00
|
|
|
export default SearchResultItem;
|