feat(settings): toggle sidebar on small screens when section is selected

The settings view now hides the sidebar on small screens when a settings
section is selected.
This commit is contained in:
2026-08-02 13:58:37 +02:00
parent 813cc7c7fc
commit 4b010d03ac
+6 -1
View File
@@ -61,6 +61,10 @@ onMounted(async () => {
});
settingsLoaded.value = true;
});
const toggleSidebarIfSmallScreen = function toggleSidebarIfSmallScreen (toggleSidebarFunction) {
if (matchMedia('(max-width: 48rem)').matches) toggleSidebarFunction();
};
</script>
<template>
@@ -71,13 +75,14 @@ onMounted(async () => {
</h1>
</header>
<LeftSidebarLayout class="layout">
<template #sidebar>
<template #sidebar="{ toggleSidebar }">
<ul class="sidebar-sections-list">
<li v-for="section in settings">
<RouterLink
:to="`/settings/${section.name}`"
class="button button-link link sidebar-section"
:class="{ active: activeSection === section.name }"
@click="toggleSidebarIfSmallScreen(toggleSidebar)"
>
{{ t(section.i18n) }}
</RouterLink>