mirror of
https://github.com/jambonz/next-static-site.git
synced 2025-12-19 04:47:44 +00:00
Fix active navi link -- regex FTW
This commit is contained in:
@@ -9,9 +9,10 @@ import { Button, Icon, useMobileMedia } from './jambonz-ui';
|
||||
|
||||
function NaviItem({obj}) {
|
||||
const router = useRouter();
|
||||
const regex = new RegExp( `^${obj.link}` );
|
||||
const classes = {
|
||||
navi__link: true,
|
||||
active: (router.asPath === obj.link),
|
||||
active: regex.test( router.asPath ),
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user