/** * * LeftMenuLink * */ import React from 'react'; import styles from './styles.scss'; import { Link } from 'react-router'; import LeftMenuSubLinkContainer from 'components/LeftMenuSubLinkContainer'; import _ from 'lodash'; class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { let subLinksContainer; if (this.props.leftMenuLinks && this.props.leftMenuLinks.size) { subLinksContainer = ( ); } // We need to create our own active url checker, // because of the two levels router. const isLinkActive = _.startsWith(window.location.pathname.replace('/admin', ''), this.props.destination); return (
  • {this.props.label} {subLinksContainer}
  • ); } } LeftMenuLink.propTypes = { icon: React.PropTypes.string, label: React.PropTypes.string, destination: React.PropTypes.string, isActive: React.PropTypes.bool, leftMenuLinks: React.PropTypes.object, }; export default LeftMenuLink;