mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-05 19:40:30 +08:00
feat(component): init app sidebar (#2135)
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import { useTheme } from '@mui/material';
|
||||
import { useMediaQuery } from '@react-hookz/web';
|
||||
import { atom, useAtom } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
const sideBarOpenAtom = atomWithStorage('sidebarOpen', true);
|
||||
const sideBarWidthAtom = atomWithStorage('sidebarWidth', 256);
|
||||
const sidebarResizingAtom = atom(false);
|
||||
|
||||
export function useSidebarStatus() {
|
||||
return useAtom(sideBarOpenAtom);
|
||||
}
|
||||
|
||||
export function useSidebarWidth() {
|
||||
return useAtom(sideBarWidthAtom);
|
||||
}
|
||||
|
||||
export function useSidebarFloating() {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
useMediaQuery(theme.breakpoints.down('md').replace(/^@media( ?)/m, '')) ??
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
export function useSidebarResizing() {
|
||||
return useAtom(sidebarResizingAtom);
|
||||
}
|
||||
Reference in New Issue
Block a user