From b8a39521535ae4fbcef0145a02a0d7f80dad68b9 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 8 Jun 2023 15:33:36 -0400 Subject: [PATCH] show next/dev versiosn --- docs/assets/scripts/docs.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/assets/scripts/docs.js b/docs/assets/scripts/docs.js index c554248d..ecc9e3bd 100644 --- a/docs/assets/scripts/docs.js +++ b/docs/assets/scripts/docs.js @@ -243,3 +243,20 @@ document.addEventListener('turbo:load', updateActiveLinks); document.addEventListener('turbo:load', observeLinks); })(); + +// +// Show custom versions in the sidebar +// +(() => { + function updateVersion() { + const el = document.querySelector('.sidebar-version'); + if (!el) return; + + if (location.hostname === 'next.shoelace.style') el.textContent = 'Next'; + if (location.hostname === 'localhost') el.textContent = 'Development'; + } + + updateVersion(); + + document.addEventListener('turbo:load', updateVersion); +})();