mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
fix: sidebar ui fix (#4187)
This commit is contained in:
@@ -35,7 +35,7 @@ export const navWrapperStyle = style({
|
||||
'&[data-enable-animation="true"]': {
|
||||
transition: 'margin-left .3s .05s, width .3s .05s',
|
||||
},
|
||||
'&.has-background': {
|
||||
'&[data-is-floating="false"].has-background': {
|
||||
backgroundColor: 'var(--affine-white-60)',
|
||||
borderRight: '1px solid var(--affine-border-color)',
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Skeleton } from '@mui/material';
|
||||
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
||||
import clsx from 'clsx';
|
||||
import { useAtom, useAtomValue } from 'jotai';
|
||||
import debounce from 'lodash/debounce';
|
||||
import type { PropsWithChildren, ReactElement } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
@@ -77,10 +78,10 @@ export function AppSidebar(props: AppSidebarProps): ReactElement {
|
||||
setAppSidebarFloating(isFloating && !!open);
|
||||
}
|
||||
|
||||
onResize();
|
||||
window.addEventListener('resize', onResize);
|
||||
const dOnResize = debounce(onResize, 50);
|
||||
window.addEventListener('resize', dOnResize);
|
||||
return () => {
|
||||
window.removeEventListener('resize', onResize);
|
||||
window.removeEventListener('resize', dOnResize);
|
||||
};
|
||||
}, [appSidebarWidth, open, setAppSidebarFloating, setOpen]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user