feat(component): default collapse and float sidebar on mobile (#5077)

work for #4843

https://github.com/toeverything/AFFiNE/assets/102217452/c658dbab-4db8-4065-a3a6-3e20274b6cb9
This commit is contained in:
JimmFly
2023-11-29 02:12:13 +00:00
parent c1cf25d2d5
commit 469a18f794

View File

@@ -2,8 +2,10 @@ import { atom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export const APP_SIDEBAR_OPEN = 'app-sidebar-open';
export const appSidebarOpenAtom = atomWithStorage(APP_SIDEBAR_OPEN, true);
export const appSidebarFloatingAtom = atom(false);
export const isMobile = window.innerWidth < 768;
export const appSidebarOpenAtom = atomWithStorage(APP_SIDEBAR_OPEN, !isMobile);
export const appSidebarFloatingAtom = atom(isMobile);
export const appSidebarResizingAtom = atom(false);
export const appSidebarWidthAtom = atomWithStorage(