Use reduce to find smallest and largest inputNums.

Tab shadows are now displayed using css classes
This commit is contained in:
j433866 committed 2019-07-03 16:05:20 +01:00
1 parent b3fa1eaae2
commit 30a66f1441
3 files changed
+24 -27

No files matched your search

+8 -15
View File
@@ -251,23 +251,16 @@ class TabWaiter {
tabsList.appendChild(this.createTabElement(nums[i], active, io));
}
const firstTab = tabsList.firstElementChild,
lastTab = tabsList.lastElementChild;
// Display shadows if there are tabs left / right of the displayed tabs
if (firstTab) {
if (tabsLeft) {
firstTab.style.boxShadow = "15px 0px 15px -15px var(--primary-border-colour) inset";
} else {
firstTab.style.boxShadow = "";
}
if (tabsLeft) {
tabsList.classList.add("tabs-left");
} else {
tabsList.classList.remove("tabs-left");
}
if (lastTab) {
if (tabsRight) {
lastTab.style.boxShadow = "-15px 0px 15px -15px var(--primary-border-colour) inset";
} else {
lastTab.style.boxShadow = "";
}
if (tabsRight) {
tabsList.classList.add("tabs-right");
} else {
tabsList.classList.remove("tabs-right");
}
// Show or hide the tab bar depending on how many tabs we have