Skip to content

Instantly share code, notes, and snippets.

@nesbtesh
Last active February 1, 2017 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesbtesh/c9735ba55892b0ee4c20405205bb6a86 to your computer and use it in GitHub Desktop.
Save nesbtesh/c9735ba55892b0ee4c20405205bb6a86 to your computer and use it in GitHub Desktop.
import React from "react";
import {parseUri} from "../../../utils";
export default class AutocompleteItem extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
if(
nextProps.url !== this.props.url ||
nextProps.selected !== this.props.selected
){
return true;
}
return false;
}
render(){
const {props} = this;
const selectedClass = props.selected === true ? "selected" : "";
var path = parseUri(props.url).path;
path = path.length <= 0 ? props.url : "..." + path;
return (
<li
onMouseLeave={props.onMouseLeave}
className={selectedClass}>
<i className="ion-ios-eye"
data-image={props.image}
data-url={props.url}
data-title={props.title}
onClick={props.handlePlanetViewClick} />
<span
onMouseEnter={props.onMouseEnter}>
<div className="dot bg-mint" />
{path}
</span>
</li>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment