Skip to content

Commit

Permalink
Use featured URL when only showing one product link #6
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Mar 4, 2015
1 parent d543819 commit b2804e2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/components/products/ProductLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ var ProductLayout = React.createClass({
return p.index === product.index - 1;
});

var linkClassName = (nextProduct && previousProduct) ? 'grid-2-square' : 'grid-1';
var previousLink, nextLink
var large = ! (nextProduct && previousProduct);
var previousLink, nextLink;

if (previousProduct)
previousLink = <ProductLink product={previousProduct} className={linkClassName}/>;
previousLink = <ProductLink product={previousProduct} large={large}/>;

if (nextProduct)
nextLink = <ProductLink product={nextProduct} className={linkClassName}/>;
nextLink = <ProductLink product={nextProduct} large={large}/>;

return (
<PageLayout className={'product-' + product.name} {...this.props}>
{this.props.children}
Expand All @@ -42,10 +43,12 @@ var ProductLink = React.createClass({

render: function() {
var product = this.props.product;
var className = this.props.className;
var other = _.omit(this.props, 'product', 'className');
var large = this.props.large;
var other = _.omit(this.props, 'product', 'large');

var imageUrl = this.imageSource(product.thumbnailUrl);
var sourceUrl = large ? product.featureUrl : product.thumbnailUrl;
var imageUrl = this.imageSource(sourceUrl);
var className = large ? 'grid-1' : 'grid-2-square';
className += ' item-project bg-image';

return (
Expand Down

0 comments on commit b2804e2

Please sign in to comment.