mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 20:02:01 +00:00
NavMenu adapted to Popup changes
This commit is contained in:
parent
b588fa08c9
commit
342e497df3
3 changed files with 90 additions and 80 deletions
|
|
@ -13,17 +13,27 @@ const NavMenu = ({ className }) => {
|
|||
const [menuOpen, openMenu, closeMenu, toggleMenu] = useBinaryState(false);
|
||||
const [fullscreen, requestFullscreen, exitFullscreen] = useFullscreen();
|
||||
const user = useUser();
|
||||
const popupLabelOnClick = React.useCallback((event) => {
|
||||
if (!event.nativeEvent.togglePopupPrevented) {
|
||||
toggleMenu();
|
||||
}
|
||||
}, [toggleMenu]);
|
||||
const popupMenuOnClick = React.useCallback((event) => {
|
||||
event.nativeEvent.togglePopupPrevented = true;
|
||||
}, []);
|
||||
return (
|
||||
<Popup
|
||||
open={menuOpen}
|
||||
direction={'bottom'}
|
||||
onCloseRequest={closeMenu}
|
||||
renderLabel={(ref) => (
|
||||
<Button ref={ref} className={classnames(className, styles['nav-menu-label-container'], { 'active': menuOpen })} tabIndex={-1} onClick={toggleMenu}>
|
||||
renderLabel={({ ref, className: popupLabelClassName, children }) => (
|
||||
<Button ref={ref} className={classnames(className, popupLabelClassName, styles['nav-menu-label-container'], { 'active': menuOpen })} tabIndex={-1} onClick={popupLabelOnClick}>
|
||||
<Icon className={styles['icon']} icon={'ic_more'} />
|
||||
{children}
|
||||
</Button>
|
||||
)}
|
||||
renderMenu={() => (
|
||||
<div className={styles['nav-menu-container']}>
|
||||
<div className={styles['nav-menu-container']} onClick={popupMenuOnClick}>
|
||||
<div className={styles['user-info-container']}>
|
||||
<div
|
||||
className={styles['avatar-container']}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,9 @@
|
|||
height: 50%;
|
||||
fill: var(--color-surfacelighter);
|
||||
}
|
||||
}
|
||||
|
||||
.nav-menu-container {
|
||||
min-width: 20rem;
|
||||
max-width: 30rem;
|
||||
width: 20rem;
|
||||
background-color: var(--color-background);
|
||||
|
||||
.user-info-container {
|
||||
|
|
@ -118,3 +116,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
align-items: center;
|
||||
height: var(--nav-bar-size);
|
||||
background-color: var(--color-secondarydark);
|
||||
overflow: visible;
|
||||
|
||||
.nav-tab-button {
|
||||
flex: none;
|
||||
|
|
|
|||
Loading…
Reference in a new issue