]> git.localhorst.tv Git - alttp.git/commitdiff
fix sticky nav
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 28 Feb 2023 08:56:16 +0000 (09:56 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 28 Feb 2023 08:56:16 +0000 (09:56 +0100)
resources/js/components/common/Header.js

index 1bb2ce18c18f676af2d935bccebf62429e189aac..53119bc13fde6844d8dfa809afa44dee7221668d 100644 (file)
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
 import React from 'react';
 import { Button, Container, Nav, Navbar } from 'react-bootstrap';
 import { LinkContainer } from 'react-router-bootstrap';
+import { useLocation } from 'react-router-dom';
 import { useTranslation } from 'react-i18next';
 
 import Icon from './Icon';
@@ -10,6 +11,7 @@ import { getAvatarUrl } from '../../helpers/User';
 import { withUser } from '../../helpers/UserContext';
 
 const Header = ({ doLogout, user }) => {
+       const { pathname } = useLocation();
        const { t } = useTranslation();
 
        return <Navbar id="header" bg="dark" variant="dark">
@@ -19,7 +21,7 @@ const Header = ({ doLogout, user }) => {
                                        ALttP
                                </Navbar.Brand>
                        </LinkContainer>
-                       <Nav>
+                       <Nav activeKey={pathname}>
                                <LinkContainer to="/tournaments/6">
                                        <Nav.Link href="/tournaments/6">
                                                ALttPR Weekly
@@ -31,7 +33,7 @@ const Header = ({ doLogout, user }) => {
                                        </Nav.Link>
                                </LinkContainer>
                        </Nav>
-                       <Nav className="ms-auto">
+                       <Nav activeKey={pathname} className="ms-auto">
                                <LinkContainer to="/tech">
                                        <Nav.Link href="/tech">
                                                {t('menu.tech')}