diff --git a/frontend/src/component/admin/menu/AdminTabsMenu.tsx b/frontend/src/component/admin/menu/AdminTabsMenu.tsx index 685f4f76a2..8140bb0f9d 100644 --- a/frontend/src/component/admin/menu/AdminTabsMenu.tsx +++ b/frontend/src/component/admin/menu/AdminTabsMenu.tsx @@ -1,4 +1,4 @@ -import { useLocation } from 'react-router-dom'; +import { useLocation, useNavigate } from 'react-router-dom'; import { Paper, styled, Tab, Tabs } from '@mui/material'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { CenteredNavLink } from './CenteredNavLink'; @@ -23,6 +23,7 @@ const StyledBadgeContainer = styled('div')(({ theme }) => ({ export const AdminTabsMenu: VFC = () => { const { uiConfig, isPro, isOss } = useUiConfig(); const { pathname } = useLocation(); + const navigate = useNavigate(); const activeTab = pathname.split('/')[2]; @@ -55,6 +56,7 @@ export const AdminTabsMenu: VFC = () => { > {tabs.map(tab => ( { - const navLinkStyle = { - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - width: '100%', - textDecoration: 'none', - color: 'inherit', - padding: props.theme.spacing(1.5, 3), - }; - - const activeNavLinkStyle: React.CSSProperties = { +const StyledNavLink = styled(NavLink)(({ theme }) => ({ + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + width: '100%', + height: '100%', + textDecoration: 'none', + color: 'inherit', + padding: theme.spacing(0, 5), + '&.active': { fontWeight: 'bold', - borderRadius: '3px', - padding: props.theme.spacing(1.5, 3), - }; - - return props.isActive - ? { ...navLinkStyle, ...activeNavLinkStyle } - : navLinkStyle; -}; + }, +})); export const CenteredNavLink: FC<{ to: string }> = ({ to, children }) => { - const theme = useTheme(); - return ( - createNavLinkStyle({ isActive, theme })} - > - {children} - - ); + return {children}; }; diff --git a/frontend/src/component/menu/Header/NavigationMenu/NavigationMenu.tsx b/frontend/src/component/menu/Header/NavigationMenu/NavigationMenu.tsx index da60c200cb..56b538a987 100644 --- a/frontend/src/component/menu/Header/NavigationMenu/NavigationMenu.tsx +++ b/frontend/src/component/menu/Header/NavigationMenu/NavigationMenu.tsx @@ -98,9 +98,9 @@ export const NavigationMenu = ({ } arrow placement="left" + key={option.path} >