Last active
February 1, 2017 18:12
-
-
Save nesbtesh/c9735ba55892b0ee4c20405205bb6a86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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