45 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-08-24 15:09:42 +02:00
/**
2017-03-18 17:34:00 +01:00
*
* LeftMenuLink
*
*/
2016-08-24 15:09:42 +02:00
import React from 'react';
import styles from './styles.scss';
2016-08-25 10:47:15 +02:00
import { Link } from 'react-router';
2017-03-15 11:48:56 +01:00
import LeftMenuSubLinkContainer from 'components/LeftMenuSubLinkContainer';
2016-08-24 15:09:42 +02:00
class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
2017-03-15 11:48:56 +01:00
let subLinksContainer;
2017-03-18 17:34:00 +01:00
if (this.props.leftMenuLinks && this.props.leftMenuLinks.size) {
subLinksContainer = (
<LeftMenuSubLinkContainer
subLinks={this.props.leftMenuLinks}
destinationPrefix={this.props.destination}
/>
);
2017-03-15 11:48:56 +01:00
}
2016-08-24 15:09:42 +02:00
return (
2017-03-15 11:48:56 +01:00
<li>
<Link className={`${styles.link} ${this.props.isActive ? styles.linkActive : ''}`} to={this.props.destination}>
2016-08-24 15:09:42 +02:00
<i className={`${styles.linkIcon} ${this.props.icon} ion`}></i>
<span className={styles.linkLabel}>{this.props.label}</span>
2016-08-25 10:47:15 +02:00
</Link>
2017-03-15 11:48:56 +01:00
{subLinksContainer}
2016-08-24 15:09:42 +02:00
</li>
);
}
}
LeftMenuLink.propTypes = {
icon: React.PropTypes.string,
label: React.PropTypes.string,
destination: React.PropTypes.string,
2016-08-30 10:53:03 +02:00
isActive: React.PropTypes.bool,
2017-03-18 17:34:00 +01:00
leftMenuLinks: React.PropTypes.object,
2016-08-24 15:09:42 +02:00
};
export default LeftMenuLink;