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

added new product tag for not more than 365 days #1633

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Next Next commit
added new tag
  • Loading branch information
bluedeepart committed Feb 5, 2025
commit 3d7684609a8ae0311b87d853083ea80327814959
9 changes: 8 additions & 1 deletion blocks/product-finder/product-finder.css
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@
display: block;
width: 100%;
overflow: hidden;
position: relative;
}

.product-finder-container #step-3 .card-thumb a {
Expand All @@ -369,6 +368,14 @@
align-items: center;
}

.product-finder-container #step-3 .card-thumb .new-product-tag {
position: absolute;
left: -7px;
top: -7px;
max-width: 100px;
height: auto;
}

.product-finder-container #step-3 .card-thumb img {
object-position: center;
object-fit: scale-down;
Expand Down
10 changes: 9 additions & 1 deletion blocks/product-finder/product-finder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ffetch from '../../scripts/ffetch.js';
import {
createOptimizedPicture,
decorateIcons, fetchPlaceholders, toClassName,
} from '../../scripts/lib-franklin.js';
import {
Expand Down Expand Up @@ -280,8 +281,15 @@ async function stepThree(e) {
const categoryData = categories.find(
(c) => c.category === originalCategory && c.type === originalType,
);

const cardThumbs = list.querySelectorAll('.card-thumb');
cardThumbs.forEach((thumb) => {
const newTagImage = createOptimizedPicture('/images/new-product-tag.png', 'New Product Tag');
newTagImage.classList.add('new-product-tag');
thumb.appendChild(newTagImage);
});

if (categoryData.displayImage === 'false') {
const cardThumbs = list.querySelectorAll('.card-thumb');
cardThumbs.forEach((thumb) => {
thumb.style.display = 'none';
});
Expand Down
Binary file added images/new-product-tag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.