/** * Add to Cart Button Component * Button with plus icon and shopping bag icon */ import { plusIcon } from "../icons/plus.js"; import { shoppingBagIcon } from "../icons/shopping-bag.js"; class AddToCartButton extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open" }); } connectedCallback() { this.render(); this.setupEventListeners(); } setupEventListeners() { const button = this.shadowRoot.querySelector(".add-to-cart-button"); if (button) { button.addEventListener("click", () => { this.dispatchEvent( new CustomEvent("add-to-cart", { bubbles: true, composed: true, }) ); }); } } render() { this.shadowRoot.innerHTML = ` `; } } customElements.define("add-to-cart-button", AddToCartButton);