Simplified AsideMenu component removing unneeded checks

This commit is contained in:
Alejandro Celaya 2018-08-12 08:26:36 +02:00
parent 073703ef5b
commit 86eb963176

View file

@ -1,18 +1,13 @@
import listIcon from '@fortawesome/fontawesome-free-solid/faBars';
import createIcon from '@fortawesome/fontawesome-free-solid/faPlus';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import React from 'react';
import { NavLink } from 'react-router-dom';
import DeleteServerButton from '../servers/DeleteServerButton';
import './AsideMenu.scss';
import listIcon from '@fortawesome/fontawesome-free-solid/faBars'
import createIcon from '@fortawesome/fontawesome-free-solid/faPlus'
import FontAwesomeIcon from '@fortawesome/react-fontawesome'
import React from 'react'
import { NavLink } from 'react-router-dom'
import DeleteServerButton from '../servers/DeleteServerButton'
import './AsideMenu.scss'
export default function AsideMenu({ selectedServer, history }) {
const serverId = selectedServer ? selectedServer.id : '';
const isListShortUrlsActive = (match, { pathname }) => {
// FIXME. Should use the 'match' params, but they are not being properly resolved. Investigate
const serverIdFromPathname = pathname.split('/')[2];
return serverIdFromPathname === serverId && pathname.indexOf('list-short-urls') !== -1;
};
return (
<aside className="aside-menu col-lg-2 col-md-3">
@ -21,7 +16,6 @@ export default function AsideMenu({ selectedServer, history }) {
className="aside-menu__item"
activeClassName="aside-menu__item--selected"
to={`/server/${serverId}/list-short-urls/1`}
isActive={isListShortUrlsActive}
>
<FontAwesomeIcon icon={listIcon} />
<span className="aside-menu__item-text">List short URLs</span>