App: Added a sidebar store with BannerAction to adjust the z-depth. CreatorLayout: Resized the content with the sidebar and added the option for a closed or open menu. Also added a value in SidebarStore to track the menu state for correct positioning.

This commit is contained in:
PascalMarchesseault
2024-11-03 10:34:57 -05:00
parent 589b4ef47b
commit 85adc04921
5 changed files with 93 additions and 111 deletions

View File

@@ -1,23 +1,16 @@
import {computed, ref} from 'vue';
import {defineStore} from "pinia";
// src/stores/sideBarStore.js
import { computed, ref } from 'vue';
import { defineStore } from 'pinia';
export const useSideBarStore = defineStore(
'sideBar',
() => {
const state = ref(false)
const visible = computed(() => state.value)
export const useSideBarStore = defineStore('sideBar', () => {
const isOpen = ref(true); // par défaut, le menu est ouvert
function toggle() {
state.value = !state.value
}
const toggle = () => {
isOpen.value = !isOpen.value;
};
function show() {
state.value = true
}
// Classe de largeur dynamique pour le contenu principal
const sidebarWidth = computed(() => (isOpen.value ? 'ml-64' : 'ml-16'));
function hide() {
state.value = false
}
return {visible, toggle, show, hide}
})
return { isOpen, toggle, sidebarWidth };
});