mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-19 13:52:12 +00:00
NavBarButton fixed for hrefs with query params
This commit is contained in:
parent
18fbdb4f1f
commit
2f287113ac
1 changed files with 4 additions and 2 deletions
|
|
@ -10,8 +10,10 @@ const NavBarButton = React.memo(({ className, icon, label, href, onClick }) => {
|
|||
const locationHash = useLocationHash();
|
||||
const active = React.useMemo(() => {
|
||||
const locationHashPath = locationHash.startsWith('#') ? locationHash.slice(1) : '';
|
||||
const { pathname } = UrlUtils.parse(locationHashPath);
|
||||
return `#${pathname}` === href;
|
||||
const hrefHashPath = typeof href === 'string' && href.startsWith('#') ? href.slice(1) : '';
|
||||
const { pathname: locationPathname } = UrlUtils.parse(locationHashPath);
|
||||
const { pathname: hrefPathname } = UrlUtils.parse(hrefHashPath);
|
||||
return locationPathname === hrefPathname;
|
||||
}, [href, locationHash]);
|
||||
const inputType = typeof onClick === 'function' ? 'button' : 'link';
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue