[READ-ONLY] Mirror of https://github.com/flo-bit/dogumentation. Simple, minimalistic documentation template using astro flo-bit.dev/dogumentation/
0

Configure Feed

Select the types of activity you want to include in your feed.

hide mobile sidebar on link click

Florian (Feb 23, 2025, 4:57 PM +0100) 5550afbf 69cfec28

+18 -2
+18 -2
src/components/Sidebar.astro
··· 35 35 : "text-base-800 dark:text-base-400 hover:text-base-950 dark:hover:text-base-50", 36 36 ]} 37 37 > 38 - <a href={config.BASE + "/docs/" + doc.id} class="w-full"> 38 + <a 39 + href={config.BASE + "/docs/" + doc.id} 40 + class="w-full sidebar-link" 41 + > 39 42 {doc.data.title} 40 43 </a> 41 44 ··· 49 52 (heading: { depth: number; text: string; slug: string }) => 50 53 heading.depth === 2 && ( 51 54 <a 52 - class="mt-2.5 text-sm ml-4 text-base-800 dark:text-base-300 hover:text-base-950 dark:hover:text-base-50" 55 + class="mt-2.5 text-sm ml-4 text-base-800 dark:text-base-300 hover:text-base-950 dark:hover:text-base-50 sidebar-link" 53 56 href={ 54 57 config.BASE + "/docs/" + doc.id + "#" + heading.slug 55 58 } ··· 71 74 )) 72 75 } 73 76 </div> 77 + 78 + <script> 79 + document.addEventListener("DOMContentLoaded", () => { 80 + // close popover when sidebar link is clicked 81 + const sidebarLinks = document.querySelectorAll(".sidebar-link"); 82 + const popover = document.getElementById("mobile-menu"); 83 + sidebarLinks.forEach((link) => { 84 + link.addEventListener("click", () => { 85 + popover?.hidePopover(); 86 + }); 87 + }); 88 + }); 89 + </script>