Author SHA1 Message Date
jakob.scheid 4b010d03ac 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.
2026-08-02 13:58:37 +02:00
jakob.scheid 813cc7c7fc feat(sidebar): allow left sidebar layout content to toggle sidebar 2026-08-02 13:57:11 +02:00
jakob.scheid a77bbec3fa refactor(sidebar): rename sidebar toggling function
Renamed the sidebar toggling function in the left sidebar layout to
toggleSidebar.
2026-08-02 13:56:25 +02:00
jakob.scheidandGitea 447207e5f0 Merge pull request 'Feat(sidebar): implement sidebar toggling' (#157) from feature/expandable-sidebar into main
Deploy on dev / Deploy on dev (push) Successful in 39s
Reviewed-on: #157
Reviewed-by: Jakob Gregory
2026-07-31 21:00:19 +02:00
2 changed files with 11 additions and 6 deletions
+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>
+5 -5
View File
@@ -29,7 +29,7 @@ const props = defineProps({
const expanded = ref(props.expanded);
const toggleExpanded = function toggleExpanded () {
const toggleSidebar = function toggleSidebar () {
expanded.value = !expanded.value;
};
</script>
@@ -37,13 +37,13 @@ const toggleExpanded = function toggleExpanded () {
<template>
<div class="layout-container" :class="{ expanded }">
<div class="sidebar-expand-button-container">
<SidebarExpandButton class="sidebar-expand-button" @click="toggleExpanded" />
<SidebarExpandButton class="sidebar-expand-button" @click="toggleSidebar" />
</div>
<Sidebar @toggle-expanded="toggleExpanded" :expanded="expanded" class="sidebar">
<slot name="sidebar" />
<Sidebar @toggle-expanded="toggleSidebar" :expanded="expanded" class="sidebar">
<slot name="sidebar" :toggleSidebar="toggleSidebar" />
</Sidebar>
<main class="main-content">
<slot />
<slot :toggleSidebar="toggleSidebar" />
</main>
</div>
</template>