patch: New right menu on mobile - JS fixed + extended through circle and project pages

This commit is contained in:
gaelle morin
2021-04-14 18:33:54 +02:00
committed by Jean-Baptiste Pasquier
parent 38e9ab1d7b
commit 5084e21d1f
10 changed files with 87 additions and 46 deletions

View File

@ -35,9 +35,9 @@ function openRightMenu() {
);
}
const control = document.querySelector('.jsMobileSidebarControl');
const buttons = control.querySelectorAll('.jsMobileRightMenuButton');
const rightMenu = control.querySelector('.jsRightMenu');
const adminControl = document.querySelector('.jsMobileSidebarAdminControl');
const buttons = adminControl.querySelectorAll('.jsMobileRightMenuButton');
const rightMenu = adminControl.querySelector('.jsRightMenu');
Array.from(buttons).forEach(button =>
button.addEventListener("click", () => {
@ -54,6 +54,30 @@ Array.from(buttons).forEach(button =>
})
)
const contentControls = Array.from(document.querySelectorAll('.jsMobileContentSidebarControl'));
contentControls.forEach(
contentControl => {
const contentSidebar = contentControl.querySelector('.jsRightMenu');
const contentButtons = contentControl.querySelectorAll('.jsMobileRightMenuButton');
Array.from(contentButtons).forEach(contentButton =>
contentButton.addEventListener('click', () => {
if (contentButton.classList.contains('icon-close')) {
contentButton.classList.remove('icon-close');
contentButton.classList.add('icon-options-vertical');
totosidebar.setAttribute('hidden', '');
}
else {
contentButton.classList.remove('icon-options-vertical');
contentButton.classList.add('icon-close');
totosidebar.removeAttribute('hidden');
};
})
)
}
);