From e33671a8ff5f0c38a92ce808484b35eb9eb2cafc Mon Sep 17 00:00:00 2001 From: JakeSCahill Date: Wed, 26 Apr 2023 10:50:51 +0100 Subject: [PATCH] Improve nav tree template --- src/helpers/length.js | 12 ++++++++++++ src/js/09-switch-theme.js | 2 -- src/partials/form-404.hbs | 14 ++++++++------ src/partials/nav-explore.hbs | 10 +++++----- 4 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 src/helpers/length.js diff --git a/src/helpers/length.js b/src/helpers/length.js new file mode 100644 index 00000000..a1340816 --- /dev/null +++ b/src/helpers/length.js @@ -0,0 +1,12 @@ +'use-strict' + +module.exports = (obj) => { + return Object.values(obj).filter((component) => { + return !( + component.latest && + component.latest.asciidoc && + component.latest.asciidoc.attributes && + component.latest.asciidoc.attributes['page-exclude-from-dropdown-selector'] + ) + }).length +} diff --git a/src/js/09-switch-theme.js b/src/js/09-switch-theme.js index f08ba851..bf835bcf 100644 --- a/src/js/09-switch-theme.js +++ b/src/js/09-switch-theme.js @@ -7,7 +7,6 @@ let theme = window.localStorage.getItem('theme') function setTheme (switchButton) { - console.log(theme) const img = switchButton.querySelector('img:first-child') if (theme === 'dark') { const newSrc = img.src.replace('view-sun', 'view-moon') @@ -24,7 +23,6 @@ } switchButton.addEventListener('click', function () { - console.log(theme) theme = theme === 'light' ? 'dark' : 'light' window.localStorage.setItem('theme', theme) setTheme(this) diff --git a/src/partials/form-404.hbs b/src/partials/form-404.hbs index c82a7936..19c43f53 100644 --- a/src/partials/form-404.hbs +++ b/src/partials/form-404.hbs @@ -12,11 +12,6 @@ diff --git a/src/partials/nav-explore.hbs b/src/partials/nav-explore.hbs index 38f305a8..4938a0e3 100644 --- a/src/partials/nav-explore.hbs +++ b/src/partials/nav-explore.hbs @@ -1,12 +1,14 @@ -{{#if (and (ne page.component.name 'home') (ne page.component.name 'ROOT'))}}