* . * . * . * . * . * specs * specs * . * . * merge * moving cheese around * layout * . * merge * Fixed invalid selector for search. * Fixed issue with URL not updating after a search. * do things better * kinda merge * whoops * whoops * . * . * im a backend developer * tooltips 1.0.1 * tooltips 1.0.1 * fix * specs * . * reduce the spacing * schema drop * reverts * revert * reverts * revert * drop unused nav * drop unused nav * drop unused nav * drop unused nav * typos * paths fixes * speeding up JS * js * search * Reworked initializeTopBarIcons.js * Reworked initializeNavigation.js * Small refactor and updated exported function API docs. * Fixed a bug I created when refactoring the top navigation icons. * sidebar nav links * spec * Fixed issues with logged out experience for top nav icons. * Small refactor of top nav icons. * Small refactor and added some API docs. * Added @testing-library/dom * Added tests for top navigation utilities. * spec * spec Co-authored-by: Nick Taylor <nick@dev.to>
30 lines
992 B
JavaScript
30 lines
992 B
JavaScript
import {
|
|
initializeMobileMenu,
|
|
setCurrentPageIconLink,
|
|
getInstantClick,
|
|
} from '../topNavigation/utilities';
|
|
|
|
function getPageEntries() {
|
|
return Object.entries({
|
|
'notifications-index': document.getElementById('notifications-link'),
|
|
'chat_channels-index': document.getElementById('connect-link'),
|
|
'moderations-index': document.getElementById('moderation-link'),
|
|
'stories-search': document.getElementById('search-link'),
|
|
});
|
|
}
|
|
|
|
const menus = [...document.getElementsByClassName('js-hamburger-trigger')];
|
|
const moreMenus = [...document.getElementsByClassName('js-nav-more-trigger')];
|
|
|
|
getInstantClick().then((spa) => {
|
|
spa.on('change', function () {
|
|
const { currentPage } = document.getElementById('page-content').dataset;
|
|
|
|
setCurrentPageIconLink(currentPage, getPageEntries());
|
|
});
|
|
});
|
|
|
|
const { currentPage } = document.getElementById('page-content').dataset;
|
|
|
|
setCurrentPageIconLink(currentPage, getPageEntries());
|
|
initializeMobileMenu(menus, moreMenus);
|