generated from Seekra/repository-template
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b010d03ac
|
||
|
|
813cc7c7fc
|
||
|
|
a77bbec3fa
|
||
|
|
447207e5f0
|
@@ -61,6 +61,10 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
settingsLoaded.value = true;
|
settingsLoaded.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const toggleSidebarIfSmallScreen = function toggleSidebarIfSmallScreen (toggleSidebarFunction) {
|
||||||
|
if (matchMedia('(max-width: 48rem)').matches) toggleSidebarFunction();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -71,13 +75,14 @@ onMounted(async () => {
|
|||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
<LeftSidebarLayout class="layout">
|
<LeftSidebarLayout class="layout">
|
||||||
<template #sidebar>
|
<template #sidebar="{ toggleSidebar }">
|
||||||
<ul class="sidebar-sections-list">
|
<ul class="sidebar-sections-list">
|
||||||
<li v-for="section in settings">
|
<li v-for="section in settings">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="`/settings/${section.name}`"
|
:to="`/settings/${section.name}`"
|
||||||
class="button button-link link sidebar-section"
|
class="button button-link link sidebar-section"
|
||||||
:class="{ active: activeSection === section.name }"
|
:class="{ active: activeSection === section.name }"
|
||||||
|
@click="toggleSidebarIfSmallScreen(toggleSidebar)"
|
||||||
>
|
>
|
||||||
{{ t(section.i18n) }}
|
{{ t(section.i18n) }}
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const expanded = ref(props.expanded);
|
const expanded = ref(props.expanded);
|
||||||
|
|
||||||
const toggleExpanded = function toggleExpanded () {
|
const toggleSidebar = function toggleSidebar () {
|
||||||
expanded.value = !expanded.value;
|
expanded.value = !expanded.value;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -37,13 +37,13 @@ const toggleExpanded = function toggleExpanded () {
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-container" :class="{ expanded }">
|
<div class="layout-container" :class="{ expanded }">
|
||||||
<div class="sidebar-expand-button-container">
|
<div class="sidebar-expand-button-container">
|
||||||
<SidebarExpandButton class="sidebar-expand-button" @click="toggleExpanded" />
|
<SidebarExpandButton class="sidebar-expand-button" @click="toggleSidebar" />
|
||||||
</div>
|
</div>
|
||||||
<Sidebar @toggle-expanded="toggleExpanded" :expanded="expanded" class="sidebar">
|
<Sidebar @toggle-expanded="toggleSidebar" :expanded="expanded" class="sidebar">
|
||||||
<slot name="sidebar" />
|
<slot name="sidebar" :toggleSidebar="toggleSidebar" />
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
<main class="main-content">
|
<main class="main-content">
|
||||||
<slot />
|
<slot :toggleSidebar="toggleSidebar" />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user