diff --git a/klasa.js b/klasa.js index 6accf7f..a3822d7 100644 --- a/klasa.js +++ b/klasa.js @@ -191,6 +191,7 @@ const IDM_PRODUCT_QUERY = `id iconSecond iconSmall iconSmallSecond + link } } opinion{ @@ -591,18 +592,19 @@ class IdmHotspot{ ${this.markupAdditional(prod)} - ${this.markupImage(prod)} - - ${this.markupLabel(prod)} - + ${this.markupImage(prod)} + + ${this.markupLabel(prod)} +
- ${this.markupOpinions(prod)} - ${prod.name} -
- ${this.markupPrice(prod, prodExchangedData)} -
- ${this.markupAddToBasket(prod)} + ${this.markupVersions(prod)} + ${this.markupOpinions(prod)} + ${prod.name} +
+ ${this.markupPrice(prod, prodExchangedData)} +
+ ${this.markupAddToBasket(prod)}
`; @@ -633,6 +635,16 @@ class IdmHotspot{ data-product-size="${prod.sizes?.[0]?.id || 'uniw'}" aria-label="${idmHotspotTextObject["Dodaj do ulubionych"]}"> `; } + + markupVersions(prod){ + if(!this.options?.selectVersion || !prod.group?.versions || prod.group?.versions?.length === 1 ) return ""; + + return `
+ ${prod.group.versions.reduce((acc, val)=>{ + return acc + `${val.name}`; + },"")} +
` + } markupImage(prod){ let markup = ""; @@ -1407,7 +1419,7 @@ function idmHideTooltip(tooltipEl){ } -// document.addEventListener("DOMContentLoaded", ()=>{ +document.addEventListener("DOMContentLoaded", ()=>{ document.body.addEventListener("click", e=>{ const tooltipEl = e.target.closest(".idm_tooltip"); if(!e.target.closest(".idm_tooltip__info_icon") || !tooltipEl) return; @@ -1415,7 +1427,7 @@ function idmHideTooltip(tooltipEl){ e.preventDefault(); idmShowTooltip(tooltipEl); }); -// }); +}); // new IdmHotspot({ // id: "idmTestHotspot1", // title: "tescik", diff --git a/style.less b/style.less index b004028..274e0e2 100644 --- a/style.less +++ b/style.less @@ -227,3 +227,33 @@ } } } + + +// WERSJE +.idm__hotspot:has(.product__versions){ + .product__versions{ + display: grid; + grid-template-columns: repeat(5, 1fr); + gap: 1rem; + z-index: 1; + background: #fff; + clip-path: inset(0% 0 100% 0); + padding: 0.3rem 1rem; + position: absolute; + top: 0; + } + .product__content_wrapper{ + position: relative; + } + .label_icons, .product__versions{ + transition: all 0.2s; + } + .product:hover{ + .product__versions, .label_icons{ + transform: translateY(-100%); + } + .product__versions{ + clip-path: inset(0 0 0 0); + } + } +} \ No newline at end of file