Browse Source

fix(nc-gui): initial right sidebar state open

pull/3801/head
braks 2 years ago
parent
commit
9955886ea1
  1. 8
      packages/nc-gui/composables/useSidebar/index.ts

8
packages/nc-gui/composables/useSidebar/index.ts

@ -27,7 +27,9 @@ const createSidebar = (id: string, props: UseSidebarProps = {}) => {
} }
if (props.useStorage) { if (props.useStorage) {
const storage = toRefs(useStorage(id, { isOpen, hasSidebar }, localStorage, { mergeDefaults: true }).value) const storage = toRefs(
useStorage(id, { isOpen: isOpen.value, hasSidebar: hasSidebar.value }, localStorage, { mergeDefaults: true }).value,
)
isOpen.value = storage.isOpen.value isOpen.value = storage.isOpen.value
hasSidebar.value = storage.hasSidebar.value hasSidebar.value = storage.hasSidebar.value
@ -61,7 +63,9 @@ const createSidebar = (id: string, props: UseSidebarProps = {}) => {
const leftSidebar = createSharedComposable(() => createSidebar('leftSidebar')) const leftSidebar = createSharedComposable(() => createSidebar('leftSidebar'))
const rightSidebar = createSharedComposable(() => createSidebar('rightSidebar', { useStorage: true, isOpen: true })) const rightSidebar = createSharedComposable(() =>
createSidebar('rightSidebar', { useStorage: true, isOpen: true, hasSidebar: true }),
)
export const useSidebar = (id: string, props: UseSidebarProps = {}) => { export const useSidebar = (id: string, props: UseSidebarProps = {}) => {
const sidebar = id.includes('left') ? leftSidebar() : rightSidebar() const sidebar = id.includes('left') ? leftSidebar() : rightSidebar()

Loading…
Cancel
Save