Merge pull request #2679 from lolbinarycat/sidebar-size-2678

fix(css): sidebar can no longer be larger than 80% of viewport width
This commit is contained in:
Eric Huss 2025-05-03 16:33:32 +00:00 committed by GitHub
commit 17b197620b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -2,7 +2,8 @@
/* Globals */
:root {
--sidebar-width: 300px;
--sidebar-target-width: 300px;
--sidebar-width: min(var(--sidebar-target-width), 80vw);
--sidebar-resize-indicator-width: 8px;
--sidebar-resize-indicator-space: 2px;
--page-padding: 15px;

View file

@ -557,9 +557,9 @@ aria-label="Show hidden lines"></button>';
sidebarToggleAnchor.addEventListener('change', function sidebarToggle() {
if (sidebarToggleAnchor.checked) {
const current_width = parseInt(
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
document.documentElement.style.getPropertyValue('--sidebar-target-width'), 10);
if (current_width < 150) {
document.documentElement.style.setProperty('--sidebar-width', '150px');
document.documentElement.style.setProperty('--sidebar-target-width', '150px');
}
showSidebar();
} else {
@ -583,7 +583,7 @@ aria-label="Show hidden lines"></button>';
showSidebar();
}
pos = Math.min(pos, window.innerWidth - 100);
document.documentElement.style.setProperty('--sidebar-width', pos + 'px');
document.documentElement.style.setProperty('--sidebar-target-width', pos + 'px');
}
}
//on mouseup remove windows functions mousemove & mouseup