generated from Seekra/repository-template
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b010d03ac
|
||
|
|
813cc7c7fc
|
||
|
|
a77bbec3fa
|
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user