mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
fix: enable arrow key nav in header menus (#900)
* fix: enable arrow key nav in header menus * refactor: improve MUI style override
This commit is contained in:
parent
3bb5a69d86
commit
629df7ee26
@ -16,7 +16,7 @@ import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|||||||
import { useCommonStyles } from 'themes/commonStyles';
|
import { useCommonStyles } from 'themes/commonStyles';
|
||||||
import { ADMIN } from 'component/providers/AccessProvider/permissions';
|
import { ADMIN } from 'component/providers/AccessProvider/permissions';
|
||||||
import { IPermission } from 'interfaces/user';
|
import { IPermission } from 'interfaces/user';
|
||||||
import NavigationMenu from './NavigationMenu/NavigationMenu';
|
import { NavigationMenu } from './NavigationMenu/NavigationMenu';
|
||||||
import { getRoutes } from 'component/menu/routes';
|
import { getRoutes } from 'component/menu/routes';
|
||||||
import { KeyboardArrowDown } from '@material-ui/icons';
|
import { KeyboardArrowDown } from '@material-ui/icons';
|
||||||
import { filterByFlags } from 'component/common/util';
|
import { filterByFlags } from 'component/common/util';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Popover, List } from '@material-ui/core';
|
import { Menu, MenuItem } from '@material-ui/core';
|
||||||
import NavigationLink from '../NavigationLink/NavigationLink';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { useStyles } from '../NavigationLink/NavigationLink.styles';
|
||||||
|
|
||||||
interface INavigationMenuProps {
|
interface INavigationMenuProps {
|
||||||
options: any[];
|
options: any[];
|
||||||
@ -9,36 +10,37 @@ interface INavigationMenuProps {
|
|||||||
style: Object;
|
style: Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NavigationMenu = ({
|
export const NavigationMenu = ({
|
||||||
options,
|
options,
|
||||||
id,
|
id,
|
||||||
handleClose,
|
handleClose,
|
||||||
anchorEl,
|
anchorEl,
|
||||||
style,
|
style,
|
||||||
}: INavigationMenuProps) => {
|
}: INavigationMenuProps) => {
|
||||||
|
const styles = useStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Menu
|
||||||
id={id}
|
id={id}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
open={Boolean(anchorEl)}
|
open={Boolean(anchorEl)}
|
||||||
onMouseLeave={handleClose}
|
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<List>
|
{options.map(option => {
|
||||||
{options.map(option => {
|
return (
|
||||||
return (
|
<MenuItem
|
||||||
<NavigationLink
|
key={option.path}
|
||||||
key={option.path}
|
component={Link}
|
||||||
handleClose={handleClose}
|
to={option.path}
|
||||||
path={option.path}
|
onClick={handleClose}
|
||||||
text={option.title}
|
classes={{ root: styles.navMenuLink }}
|
||||||
/>
|
>
|
||||||
);
|
<span className={styles.menuItemBox} />
|
||||||
})}
|
{option.title}
|
||||||
</List>
|
</MenuItem>
|
||||||
</Popover>
|
);
|
||||||
|
})}
|
||||||
|
</Menu>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NavigationMenu;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user