File size: 1,806 Bytes
fccc18d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
// navigation.js
export let isTraditionalLayout = false;
export function updateLayout() {
const carousel = document.getElementById('carousel');
const carouselWrapper = document.getElementById('carouselWrapper');
const toggleLayoutBtn = document.getElementById('toggleLayoutBtn');
const prevBtn = document.getElementById('prevBtn');
const nextBtn = document.getElementById('nextBtn');
if (isTraditionalLayout) {
carousel.classList.add('traditional');
carouselWrapper.classList.add('traditional-mode');
prevBtn.style.display = 'none';
nextBtn.style.display = 'none';
toggleLayoutBtn.innerHTML = `<img src="assets/vertical.svg" alt="Icon" class="svg-icon">`;
} else {
carousel.classList.remove('traditional');
carouselWrapper.classList.remove('traditional-mode');
prevBtn.style.display = '';
nextBtn.style.display = '';
toggleLayoutBtn.innerHTML = `<img src="assets/horizontal.svg" alt="Icon" class="svg-icon">`;
}
}
export function updateHamburgerPosition() {
const hamburgerBtn = document.getElementById('hamburgerBtn');
const newSessionBtn = document.getElementById('newSessionBtn');
const toggleLayoutBtn = document.getElementById('toggleLayoutBtn');
const navBar = document.getElementById('navBar');
const navHeader = navBar.querySelector('.nav-header');
const headerLeft = document.getElementById('headerLeft');
if (navBar.classList.contains('hidden')) {
headerLeft.appendChild(hamburgerBtn);
headerLeft.appendChild(newSessionBtn);
headerLeft.appendChild(toggleLayoutBtn);
} else {
navHeader.appendChild(hamburgerBtn);
navHeader.appendChild(newSessionBtn);
navHeader.appendChild(toggleLayoutBtn);
}
}
export function toggleLayout() {
isTraditionalLayout = !isTraditionalLayout;
updateLayout();
}
|