From 363f9617ff2f72f58634555d3c9bbb27f867757e Mon Sep 17 00:00:00 2001 From: ploiu Date: Mon, 16 May 2022 13:02:45 -0400 Subject: [PATCH] fix folder item overflow --- js/SiteFolderElement.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/SiteFolderElement.js b/js/SiteFolderElement.js index 95b48ec..92c49e5 100644 --- a/js/SiteFolderElement.js +++ b/js/SiteFolderElement.js @@ -21,10 +21,14 @@ class SiteFolderElement extends HTMLElement { this.dataset.name; // we want to show small icons of each site we contain const folder = this.#shadow.querySelector("div.folder"); + let siteCount = 0; this.#sites.forEach((site) => { - const image = document.createElement("img"); - image.src = site.img; - folder.appendChild(image); + if (siteCount < 9) { + const image = document.createElement("img"); + image.src = site.img; + folder.appendChild(image); + } + siteCount++; }); // click handler for showing dialog this.addEventListener("click", this.openFolder);