mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-05 13:56:51 +00:00
fix: new rail type sidebar
This commit is contained in:
28
packages/nc-gui/composables/useMiniSidebarMode.ts
Normal file
28
packages/nc-gui/composables/useMiniSidebarMode.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { MINI_SIDEBAR_V2_DOCK_WIDTH, MINI_SIDEBAR_V2_RAIL_WIDTH } from '~/lib/constants'
|
||||
|
||||
export type MiniSidebarMode = 'rail' | 'dock'
|
||||
|
||||
export const useMiniSidebarMode = createSharedComposable(() => {
|
||||
const mode = useStorage<MiniSidebarMode>('nc-mini-sidebar-mode', 'rail')
|
||||
|
||||
const isRail = computed(() => mode.value === 'rail')
|
||||
|
||||
const isDock = computed(() => mode.value === 'dock')
|
||||
|
||||
const toggleMode = () => {
|
||||
mode.value = mode.value === 'rail' ? 'dock' : 'rail'
|
||||
}
|
||||
|
||||
const currentWidth = computed(() => {
|
||||
return mode.value === 'rail' ? MINI_SIDEBAR_V2_RAIL_WIDTH : MINI_SIDEBAR_V2_DOCK_WIDTH
|
||||
})
|
||||
|
||||
return {
|
||||
mode,
|
||||
isRail,
|
||||
isDock,
|
||||
toggleMode,
|
||||
currentWidth,
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user