Fixed first item on aside menu only selected when in first page

This commit is contained in:
Alejandro Celaya 2018-09-02 10:44:52 +02:00
parent 850630092a
commit 2b44d1b009

View file

@ -25,6 +25,7 @@ export default function AsideMenu({ selectedServer, className, showOnMobile }) {
const asideClass = classnames('aside-menu', className, { const asideClass = classnames('aside-menu', className, {
'aside-menu--hidden': !showOnMobile, 'aside-menu--hidden': !showOnMobile,
}); });
const shortUrlsIsActive = (match, location) => location.pathname.match('/list-short-urls');
return ( return (
<aside className={asideClass}> <aside className={asideClass}>
@ -33,6 +34,7 @@ export default function AsideMenu({ selectedServer, className, showOnMobile }) {
className="aside-menu__item" className="aside-menu__item"
activeClassName="aside-menu__item--selected" activeClassName="aside-menu__item--selected"
to={`/server/${serverId}/list-short-urls/1`} to={`/server/${serverId}/list-short-urls/1`}
isActive={shortUrlsIsActive}
> >
<FontAwesomeIcon icon={listIcon} /> <FontAwesomeIcon icon={listIcon} />
<span className="aside-menu__item-text">List short URLs</span> <span className="aside-menu__item-text">List short URLs</span>