diff --git a/index.js b/index.js index 75dd477..6db12bf 100644 --- a/index.js +++ b/index.js @@ -1,83 +1,106 @@ -class IdmQuantityPicker{ - constructor({selector , min, max, ref}) { - const container = selector ? document.querySelector(selector) : ref; +class IdmBasketHotspot { + + constructor({ selector, products }) { + const container = document.querySelector(selector); if(!container){ - console.error("IdmQuantityPicker: container not found."); + console.error("IdmBasketHotspotConstructor: container not found.") return; } - this.container=container; - const input = this.container.querySelector(".idm-quantity-picker__input"); - if(!input){ - console.error("IdmQuantityPicker: input not found"); + if(!products){ + console.error("IdmBasketHotspotConstructor: no products") return; } - this.input = input; - - if(typeof min === "undefined"){ - min = this.input.min; - }else{ - this.input.min=min; - } - - if(typeof min === "undefined"){ - max = this.input.max; - }else{ - this.input.max=max; - } - - this.min = min; - this.max = max; - this._value = Number.parseInt(input.value); + this.container = container; + this.products = [...products]; + this.init(); } - updateInput(){ - this.input.value = this._value; + getCard(){ + return `
+ Kup produkt do 50% taniej.
+