From b2804e24cbc37042ab67773effae31a016dae41f Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Wed, 4 Mar 2015 13:18:11 +1100 Subject: [PATCH] Use featured URL when only showing one product link #6 --- app/components/products/ProductLayout.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/components/products/ProductLayout.jsx b/app/components/products/ProductLayout.jsx index 46e8b48..b293456 100644 --- a/app/components/products/ProductLayout.jsx +++ b/app/components/products/ProductLayout.jsx @@ -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 = ; + previousLink = ; if (nextProduct) - nextLink = ; + nextLink = ; + return ( {this.props.children} @@ -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 (