ReviewOS

also looking at this

stacks/bunpress

fix(spa): repair client-side router and polish default theme

#71
Merged glennmichael123 wants to merge fix/spa-nav-and-theme-polish into main
9 files +1037 -170
packages/bunpress/src/templates/sidebar.stxmodified+22-0
Changes to packages/bunpress/src/templates/sidebar.stx
@@ -1,9 +1,31 @@
1<div class="VPSidebar-backdrop" onclick="toggleSidebar(false)"></div>
12<nav class="VPSidebar">
23 <div class="sidebar-content">
34 {!! sections !!}
45 </div>
56</nav>
67
8<script>
9function toggleSidebar(forceState) {
10 var sb = document.querySelector('.VPSidebar');
11 var bd = document.querySelector('.VPSidebar-backdrop');
12 if (!sb) return;
13 var nextOpen = typeof forceState === 'boolean' ? forceState : !sb.classList.contains('is-open');
14 sb.classList.toggle('is-open', nextOpen);
15 if (bd) bd.classList.toggle('is-open', nextOpen);
16 document.body.style.overflow = nextOpen ? 'hidden' : '';
17}
18if (!window.__bpSidebarBound) {
19 window.__bpSidebarBound = true;
20 // Close drawer when the user clicks a sidebar link on mobile
21 document.addEventListener('click', function(e) {
22 if (window.matchMedia('(min-width: 960px)').matches) return;
23 var a = e.target.closest('.VPSidebar a');
24 if (a) toggleSidebar(false);
25 });
26}
27</script>
28
729<style>
830.VPSidebar {
931 position: fixed;