Files
old-ribica/front-ui/app/components/items/singleItem.js

53 lines
1.8 KiB
JavaScript

var React = require('react');
var ItemActions = require('../../actions/itemActions');
var NavigationActions = require('../../actions/navigationActions');
var NavigationStore = require('../../stores/navigationStore')
var Router = require('react-router');
var SingleItem = React.createClass({
render: function() {
var hidePrice = this.props.hidePrice || false;
var self = this;
var itemClick = this.itemClick;
var firstImage = this.props.item.get('multi_media_descriptions')[0];
firstImage = firstImage || { resized_url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
if (hidePrice) {
return (
<div className="col-lg-2 col-md-2 col-sm-3 col-xs-6">
<div className="productbox">
<img className="img-responsive" src={firstImage.url} alt="product image" />
<div>
<p>{ this.props.item.get('brand') ? this.props.item.get('brand').name : '' }{ this.props.item.get('name') }</p>
</div>
</div>
</div>
);
}
else {
return (
<div className="col-lg-3 col-md-3 col-sm-4 col-xs-6" onClick={itemClick}>
<div className="productbox">
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
<div style={{height: "110px"}}>
<p>{ this.props.item.get('brand') ? this.props.item.get('brand').name : '' }{ this.props.item.get('name') }</p>
<h4>{ this.props.item.get('list_price') } KM </h4>
</div>
</div>
</div>
);
}
},
itemClick: function(e) {
NavigationActions.goToItemDetails(this.props.item);
}
});
module.exports = SingleItem;