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:
@@ -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 };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user