From 506a42c58f9d0587bb1e101d1d5999fa051c7ad8 Mon Sep 17 00:00:00 2001 From: Yann Bertrand <5855339+yannbertrand@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:46:18 +0100 Subject: [PATCH] feat(mon-pix): allow to navigate using sidebar menu in module --- mon-pix/app/components/module/_navbar.scss | 4 ++ mon-pix/app/components/module/navbar.gjs | 4 -- mon-pix/app/components/module/passage.gjs | 7 +++ .../components/module/navbar_test.gjs | 54 +++++++++++++++---- .../components/module/passage_test.gjs | 41 +++++++++++++- 5 files changed, 94 insertions(+), 16 deletions(-) diff --git a/mon-pix/app/components/module/_navbar.scss b/mon-pix/app/components/module/_navbar.scss index 8c78391f22b..0611b1c2d5e 100644 --- a/mon-pix/app/components/module/_navbar.scss +++ b/mon-pix/app/components/module/_navbar.scss @@ -37,4 +37,8 @@ color: var(--pix-primary-700); background-color: var(--pix-neutral-20); } + + &:active { + background-color: var(--pix-neutral-100); + } } diff --git a/mon-pix/app/components/module/navbar.gjs b/mon-pix/app/components/module/navbar.gjs index 01fc8107647..3c04f9b8e81 100644 --- a/mon-pix/app/components/module/navbar.gjs +++ b/mon-pix/app/components/module/navbar.gjs @@ -44,10 +44,6 @@ export default class ModulixNavbar extends Component { return this.grainsWithIdAndTranslatedType.length - 1; } - isActive(index) { - return index + 1 === this.grainsWithIdAndTranslatedType.length; - } - @action onMenuItemClick(grainId) { this.closeSidebar(); diff --git a/mon-pix/app/components/module/passage.gjs b/mon-pix/app/components/module/passage.gjs index e107fe6c1d7..9f3578342d6 100644 --- a/mon-pix/app/components/module/passage.gjs +++ b/mon-pix/app/components/module/passage.gjs @@ -196,6 +196,12 @@ export default class ModulePassage extends Component { }); } + @action + async goToGrain(grainId) { + const element = document.getElementById(`grain_${grainId}`); + this.modulixAutoScroll.focusAndScroll(element); + } +