Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the thumb icons from the homepage #2207

Merged
merged 8 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions network-api/networkapi/buyersguide/templates/buyersguide_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,22 @@ <h1 class="h1-heading text-center mt-4">Shop Safe This Holiday Season</h1>
<div class="d-flex justify-content-center align-items-stretch flex-wrap">
{% for product in products %}
<div class="product-box bg-gray" data-creepiness="{{ product.votes.creepiness.average }}">
<div class="iconography-bar">
{% if product.meets_minimum_security_standards is True %}
<img
class="seal-of-approval"
src="/_images/buyers-guide/mini-badge.svg"
title="this product meets our minimum security standards"
alt="this product meets our minimum security standards"
>
{% endif %}
{% if product.meets_minimum_security_standards is True %}
<img
class="seal-of-approval"
src="/_images/buyers-guide/mini-badge.svg"
title="this product meets our minimum security standards"
alt="this product meets our minimum security standards"
>
{% endif %}

{% if product.votes.confidence %}
{% if product.votes.confidence.1 > product.votes.confidence.0 %}
<div class="recommendation positive m-2"></div>
{% else %}
<div class="recommendation negative m-2"></div>
{% endif %}
{% if product.votes.confidence %}
{% if product.votes.confidence.1 > product.votes.confidence.0 %}
<div class="d-none recommendation positive m-2"></div>
{% else %}
<div class="d-none recommendation negative m-2"></div>
{% endif %}
</div>
{% endif %}

<a class="product-image" href="/en/privacynotincluded/products/{{ product.slug }}">
{% if USE_CLOUDINARY %}
Expand Down
23 changes: 17 additions & 6 deletions source/js/buyers-guide/components/filter/filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
65 changes: 33 additions & 32 deletions source/sass/buyers-guide/views/homepage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
}

.product-box {
position: relative;
width: calc(50% - 2px);
margin: 1px;
overflow: hidden;
Expand All @@ -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;
Expand Down Expand Up @@ -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%;
}
}
}