mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-18 08:12:01 +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 notificationLinkRef = useRef();
|
||||||
const [menuState, setMenuState] = useState('closed');
|
const [menuState, setMenuState] = useState(undefined);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -61,9 +61,10 @@ function Home() {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (window.matchMedia('(min-width: calc(40em))').matches) {
|
if (window.matchMedia('(min-width: calc(40em))').matches) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setMenuState((state) =>
|
setMenuState((state) => {
|
||||||
state === 'closed' ? 'open' : 'closed',
|
console.log('state', state, !state ? 'open' : undefined);
|
||||||
);
|
return !state ? 'open' : undefined;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -72,7 +73,7 @@ function Home() {
|
||||||
<NotificationsMenu
|
<NotificationsMenu
|
||||||
state={menuState}
|
state={menuState}
|
||||||
anchorRef={notificationLinkRef}
|
anchorRef={notificationLinkRef}
|
||||||
onClose={() => setMenuState('closed')}
|
onClose={() => setMenuState(undefined)}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
@ -163,7 +164,6 @@ function NotificationsMenu({ anchorRef, state, onClose }) {
|
||||||
position="anchor"
|
position="anchor"
|
||||||
align="center"
|
align="center"
|
||||||
boundingBoxPadding="8 8 8 8"
|
boundingBoxPadding="8 8 8 8"
|
||||||
unmountOnClose
|
|
||||||
>
|
>
|
||||||
<header>
|
<header>
|
||||||
<h2>Notifications</h2>
|
<h2>Notifications</h2>
|
||||||
|
|
Loading…
Add table
Reference in a new issue