mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(mobile): close menu when detail page navigate away (#8027)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { ArrowLeftSmallIcon } from '@blocksuite/icons/rc';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
import clsx from 'clsx';
|
||||
@@ -48,10 +49,13 @@ export const MobileMenu = ({
|
||||
[onPointerDownOutside, rootOptions]
|
||||
);
|
||||
|
||||
const onItemClick = useCallback((e: any) => {
|
||||
e.preventDefault();
|
||||
setOpen(prev => !prev);
|
||||
}, []);
|
||||
const onItemClick = useCallback(
|
||||
(e: any) => {
|
||||
e.preventDefault();
|
||||
onOpenChange(!open);
|
||||
},
|
||||
[onOpenChange, open]
|
||||
);
|
||||
|
||||
// dynamic height for slider
|
||||
useEffect(() => {
|
||||
@@ -78,6 +82,8 @@ export const MobileMenu = ({
|
||||
};
|
||||
}, [activeIndex, finalOpen]);
|
||||
|
||||
const t = useI18n();
|
||||
|
||||
/**
|
||||
* For cascading menu usage
|
||||
* ```tsx
|
||||
@@ -139,7 +145,7 @@ export const MobileMenu = ({
|
||||
onClick={() => setSubMenus(prev => prev.slice(0, index))}
|
||||
prefixStyle={{ width: 20, height: 20 }}
|
||||
>
|
||||
Back
|
||||
{t['com.affine.backButton']()}
|
||||
</Button>
|
||||
|
||||
{sub.items}
|
||||
|
||||
Reference in New Issue
Block a user