From 1a6ae9fd652ac286e28fdd50f98623c2560b1d61 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 22 Aug 2024 13:25:10 +0100 Subject: [PATCH] fix cheat sheet bugs --- src/js/50-cheat-sheet-toggle.js | 8 +++++++- src/partials/nav-selectors.hbs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/js/50-cheat-sheet-toggle.js b/src/js/50-cheat-sheet-toggle.js index ff0af990..eb72a47c 100644 --- a/src/js/50-cheat-sheet-toggle.js +++ b/src/js/50-cheat-sheet-toggle.js @@ -26,8 +26,14 @@ const prodMatrix = { // get the default product from optionMap const defaultProdArray = optionMap.find((prod) => prod.default === 'true') -const defaultProd = defaultProdArray ? defaultProdArray.value : optionMap[0].value +// display for 'all' products unless a differnt value is specified via attributes in source +let defaultProd +if (defaultProdArray && optionMap) { + defaultProd = defaultProdArray ? defaultProdArray.value : optionMap[0].value +} else { + defaultProd = 'all' +} const defaultClasses = ['exampleblock', 'sect2', 'sect1'] document.addEventListener('DOMContentLoaded', function () { diff --git a/src/partials/nav-selectors.hbs b/src/partials/nav-selectors.hbs index 65c9e705..a63a6301 100644 --- a/src/partials/nav-selectors.hbs +++ b/src/partials/nav-selectors.hbs @@ -17,7 +17,7 @@