diff --git a/network-api/networkapi/buyersguide/templates/buyersguide_home.html b/network-api/networkapi/buyersguide/templates/buyersguide_home.html index 44a464a1513..7f04b53374a 100644 --- a/network-api/networkapi/buyersguide/templates/buyersguide_home.html +++ b/network-api/networkapi/buyersguide/templates/buyersguide_home.html @@ -45,24 +45,22 @@

Shop Safe This Holiday Season

{% for product in products %}
-
- {% if product.meets_minimum_security_standards is True %} - this product meets our minimum security standards - {% endif %} + {% if product.meets_minimum_security_standards is True %} + this product meets our minimum security standards + {% endif %} - {% if product.votes.confidence %} - {% if product.votes.confidence.1 > product.votes.confidence.0 %} -
- {% else %} -
- {% endif %} + {% if product.votes.confidence %} + {% if product.votes.confidence.1 > product.votes.confidence.0 %} +
+ {% else %} +
{% endif %} -
+ {% endif %} {% if USE_CLOUDINARY %} diff --git a/source/js/buyers-guide/components/filter/filter.jsx b/source/js/buyers-guide/components/filter/filter.jsx index e9401b8606e..0640526eab4 100644 --- a/source/js/buyers-guide/components/filter/filter.jsx +++ b/source/js/buyers-guide/components/filter/filter.jsx @@ -239,12 +239,23 @@ export default class Filter extends React.Component { // not hidden by creepiness: do we need to hide it due to buyers likelihood? let recommendation = productBox.querySelector(`.recommendation`); - if (like === `Likely` && recommendation.classList.contains(`negative`)) { - classes.add(`d-none`); - hidden = true; - } else if (like === `Not likely` && recommendation.classList.contains(`positive`)) { - classes.add(`d-none`); - hidden = true; + if (recommendation) { + if (like === `Both`) { + recommendation.classList.add(`d-none`); + hidden = true; + } else { + recommendation.classList.remove(`d-none`); + } + + if (hidden) { return; } + + if (like === `Likely` && recommendation.classList.contains(`negative`)) { + classes.add(`d-none`); + hidden = true; + } else if (like === `Not likely` && recommendation.classList.contains(`positive`)) { + classes.add(`d-none`); + hidden = true; + } } if (hidden) { return; } diff --git a/source/sass/buyers-guide/views/homepage.scss b/source/sass/buyers-guide/views/homepage.scss index ee74bad940d..3d0bbbab7da 100644 --- a/source/sass/buyers-guide/views/homepage.scss +++ b/source/sass/buyers-guide/views/homepage.scss @@ -43,6 +43,7 @@ } .product-box { + position: relative; width: calc(50% - 2px); margin: 1px; overflow: hidden; @@ -51,25 +52,51 @@ width: calc(33% - 2px); } - $icon-bar-height: 56px; + .seal-of-approval { + position: absolute; + top: 10px; + left: 6px; + width: 44px; + height: auto; + } + + .recommendation { + position: absolute; + right: 0; + width: 1em; + height: 1em; + + &.positive { + background-image: url(/_images/buyers-guide/icon-thumb-up.svg); + background-position: 0 0; + background-repeat: no-repeat; + background-size: 100% 100%; + } - .iconography-bar { - height: $icon-bar-height; + &.negative { + background-image: url(/_images/buyers-guide/icon-thumb-down.svg); + background-position: 0 0; + background-repeat: no-repeat; + background-size: 100% 100%; + } } .product-image { display: block; text-align: center; + $image-margin: 26px; + img { - background: #e0e0e0; - max-width: calc(100% - (#{$icon-bar-height} / 2)); + display: inline-block; + margin: $image-margin; + width: calc(100% - (#{$image-margin} * 2)); } } } .creepiness-slider { - z-index: 0; + z-index: 1; position: sticky; position: -webkit-sticky; top: 16px; @@ -133,30 +160,4 @@ } } } - - .seal-of-approval { - width: 44px; - height: auto; - margin: 10px 0 0 6px; - } - - .recommendation { - float: right; - width: 1em; - height: 1em; - - &.positive { - background-image: url(/_images/buyers-guide/icon-thumb-up.svg); - background-position: 0 0; - background-repeat: no-repeat; - background-size: 100% 100%; - } - - &.negative { - background-image: url(/_images/buyers-guide/icon-thumb-down.svg); - background-position: 0 0; - background-repeat: no-repeat; - background-size: 100% 100%; - } - } }