From c9c648adf8850f0e74645b00b935fa4a2ac83eff Mon Sep 17 00:00:00 2001 From: "louismaxime.piton" Date: Tue, 14 Feb 2023 10:28:26 +0100 Subject: [PATCH 1/5] Fix the behavior of the orange navbar in the doc + in the minimizing behavior --- js/src/orange-navbar.js | 15 +++------- js/tests/unit/orange-navbar.spec.js | 45 +++-------------------------- scss/_orange-navbar.scss | 3 +- site/assets/scss/_content.scss | 20 +++++++++++-- site/content/docs/5.3/migration.md | 3 ++ 5 files changed, 30 insertions(+), 56 deletions(-) diff --git a/js/src/orange-navbar.js b/js/src/orange-navbar.js index a39cba47bc..da88dd3bbf 100644 --- a/js/src/orange-navbar.js +++ b/js/src/orange-navbar.js @@ -35,17 +35,10 @@ class OrangeNavbar extends BaseComponent { // Static static enableMinimizing(el) { // The minimized behaviour works only if your header has .sticky-top (fixed-top will be sticky without minimizing) - const scroll = window.scrollY - const headerChildren = [...el.children] - const globalHeaderChild = headerChildren.find(element => !element.classList.contains('supra')) - - if (globalHeaderChild) { - if (scroll > 0) { - // Consider first element not having .supra in array is the first header - globalHeaderChild.classList.add('header-minimized') - } else { - globalHeaderChild.classList.remove('header-minimized') - } + if (window.scrollY > 0) { + el.classList.add('header-minimized') + } else { + el.classList.remove('header-minimized') } } diff --git a/js/tests/unit/orange-navbar.spec.js b/js/tests/unit/orange-navbar.spec.js index e372925974..63ab65be14 100644 --- a/js/tests/unit/orange-navbar.spec.js +++ b/js/tests/unit/orange-navbar.spec.js @@ -122,64 +122,27 @@ describe('OrangeNavbar', () => { it('should add .header-minimized to the global header non-supra first