fix(mobile): scroll optimization (#8362)

close AF-1421, AF-1418, AF-1423, AF-1358
This commit is contained in:
CatsJuice
2024-09-24 03:51:09 +00:00
parent e02d450e4f
commit 9eae3de1ae
10 changed files with 69 additions and 43 deletions
@@ -65,41 +65,50 @@ export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
}, [backAction]);
return (
<SafeArea
top
ref={ref}
className={clsx(styles.root, className)}
data-testid="mobile-page-header"
{...attrs}
>
<header className={styles.inner}>
<section
className={clsx(styles.prefix, prefixClassName)}
style={prefixStyle}
>
{back ? (
<IconButton
size={24}
style={{ padding: 10 }}
onClick={handleRouteBack}
icon={<ArrowLeftSmallIcon />}
/>
) : null}
{prefix}
</section>
<>
<SafeArea
top
ref={ref}
className={clsx(styles.root, className)}
data-testid="mobile-page-header"
{...attrs}
>
<header className={styles.inner}>
<section
className={clsx(styles.prefix, prefixClassName)}
style={prefixStyle}
>
{back ? (
<IconButton
size={24}
style={{ padding: 10 }}
onClick={handleRouteBack}
icon={<ArrowLeftSmallIcon />}
/>
) : null}
{prefix}
</section>
<section className={clsx(styles.content, { center: centerContent })}>
{children}
</section>
<section
className={clsx(styles.content, { center: centerContent })}
>
{children}
</section>
<section
className={clsx(styles.suffix, suffixClassName)}
style={suffixStyle}
>
{suffix}
</section>
</header>
</SafeArea>
<section
className={clsx(styles.suffix, suffixClassName)}
style={suffixStyle}
>
{suffix}
</section>
</header>
</SafeArea>
{/* Spacer */}
<SafeArea top>
<div className={styles.headerSpacer} />
</SafeArea>
</>
);
}
);
@@ -3,13 +3,16 @@ import { style } from '@vanilla-extract/css';
export const root = style({
width: '100%',
position: 'sticky',
position: 'fixed',
top: 0,
zIndex: 1,
backgroundColor: cssVarV2('layer/background/secondary'),
});
export const headerSpacer = style({
height: 44,
});
export const inner = style({
minHeight: 44,
height: 44,
padding: '0 6px',
display: 'flex',
alignItems: 'center',
@@ -3,7 +3,8 @@ import { cssVarV2 } from '@toeverything/theme/v2';
import { style } from '@vanilla-extract/css';
export const root = style({
maxHeight: 'calc(100dvh - 100px)',
maxHeight:
'calc(100dvh - 100px - env(safe-area-inset-bottom) - env(safe-area-inset-top))',
display: 'flex',
flexDirection: 'column',
});
@@ -116,7 +116,9 @@ export const SelectorMenu = ({ onClose }: { onClose?: () => void }) => {
title="Cloud Sync"
list={cloudWorkspaces}
/>
<div className={styles.divider} />
{cloudWorkspaces.length && localWorkspaces.length ? (
<div className={styles.divider} />
) : null}
<WorkspaceList
onClose={onClose}
title="Local Storage"
@@ -11,7 +11,7 @@ export const root = style({
export const header = style({
background: cssVarV2('layer/background/primary'),
position: 'sticky',
position: 'fixed',
top: 0,
zIndex: 1,
});
@@ -14,11 +14,13 @@ globalStyle(':root', {
globalStyle('body', {
height: 'auto',
minHeight: '100dvh',
overflowY: 'unset',
});
globalStyle('body:has(#app-tabs)', {
paddingBottom: globalVars.appTabHeight,
});
globalStyle('html', {
height: '100dvh',
overflowY: 'auto',
background: cssVarV2('layer/background/secondary'),
});