diff --git a/src/components/Navigation/MainMenu.tsx b/src/components/Navigation/MainMenu.tsx index 9a519b1..5449514 100644 --- a/src/components/Navigation/MainMenu.tsx +++ b/src/components/Navigation/MainMenu.tsx @@ -4,10 +4,23 @@ import classnames from "classnames" import { isUserConnected, routerSelector } from "../../store/auth" import styles from "./styles.module.scss" -const MainMenu: FC = (): JSX.Element | null => { - const connected = useSelector(isUserConnected) - const router = useSelector(routerSelector) +interface MenuItemProps { + name: string + pathname: string +} +const MenuItem: FC = ({ name, pathname }): JSX.Element => { + const router = useSelector(routerSelector) + const isActive = (router as any)?.location?.pathname === pathname + return ( +
  • + {name} +
  • + ) +} + +const MainMenu: FC = (): JSX.Element => { + const connected = useSelector(isUserConnected) const [opened, setOpened] = useState(false) const onOpen = useCallback(() => { @@ -18,16 +31,7 @@ const MainMenu: FC = (): JSX.Element | null => { setOpened(false) }, [setOpened]) - if (!connected) return null - - function createMenuItem(name: string, pathname: string): JSX.Element { - const isActive = (router as any)?.location?.pathname === pathname - return ( -
  • - {name} -
  • - ) - } + if (!connected) return
    return (