mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-25 18:55:44 +03:00
Fix mount/unmount states of notifications popover
This commit is contained in:
parent
ef06faf259
commit
18c08076dd
1 changed files with 6 additions and 6 deletions
|
@ -35,7 +35,7 @@ function Home() {
|
|||
}, []);
|
||||
|
||||
const notificationLinkRef = useRef();
|
||||
const [menuState, setMenuState] = useState('closed');
|
||||
const [menuState, setMenuState] = useState(undefined);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -61,9 +61,10 @@ function Home() {
|
|||
e.stopPropagation();
|
||||
if (window.matchMedia('(min-width: calc(40em))').matches) {
|
||||
e.preventDefault();
|
||||
setMenuState((state) =>
|
||||
state === 'closed' ? 'open' : 'closed',
|
||||
);
|
||||
setMenuState((state) => {
|
||||
console.log('state', state, !state ? 'open' : undefined);
|
||||
return !state ? 'open' : undefined;
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
@ -72,7 +73,7 @@ function Home() {
|
|||
<NotificationsMenu
|
||||
state={menuState}
|
||||
anchorRef={notificationLinkRef}
|
||||
onClose={() => setMenuState('closed')}
|
||||
onClose={() => setMenuState(undefined)}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
@ -163,7 +164,6 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
|
|||
position="anchor"
|
||||
align="center"
|
||||
boundingBoxPadding="8 8 8 8"
|
||||
unmountOnClose
|
||||
>
|
||||
<header>
|
||||
<h2>Notifications</h2>
|
||||
|
|
Loading…
Reference in a new issue