summaryrefslogtreecommitdiff
path: root/src/components/SideBar.js
diff options
context:
space:
mode:
authorHaishan <[email protected]>2018-10-23 22:43:12 +0800
committerHaishan <[email protected]>2018-10-23 22:43:12 +0800
commit09c6bf12e93ba265898c46f00bc73891cb2896dd (patch)
tree44ebd4dbd4d67cc97f70235c68747b6f3066d98a /src/components/SideBar.js
parent580a61687ba137734d80589319f127539657a443 (diff)
deps: get rid of the deprecated react-router-redux
Diffstat (limited to 'src/components/SideBar.js')
-rw-r--r--src/components/SideBar.js28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/components/SideBar.js b/src/components/SideBar.js
index 5e2d8e6..e12f276 100644
--- a/src/components/SideBar.js
+++ b/src/components/SideBar.js
@@ -1,9 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-import { Link } from 'react-router-dom';
-
-import { connect } from 'react-redux';
-// import { bindActionCreators } from 'redux';
+import { NavLink } from 'react-router-dom';
import Icon from 'c/Icon';
@@ -15,37 +12,24 @@ import yacd from 's/yacd.svg';
import s from 'c/SideBar.module.scss';
-class SideBarRowDump extends Component {
+class SideBarRow extends Component {
static propTypes = {
to: PropTypes.string.isRequired,
iconId: PropTypes.string,
- labelText: PropTypes.string,
- pathname: PropTypes.string
+ labelText: PropTypes.string
};
render() {
- const { iconId, labelText, to, pathname } = this.props;
- const cls = pathname === to ? s.rowActive : s.row;
+ const { iconId, labelText, to } = this.props;
return (
- <Link to={to} className={cls}>
+ <NavLink exact to={to} className={s.row} activeClassName={s.rowActive}>
<Icon id={iconId} width={28} height={28} />
<div className={s.label}>{labelText}</div>
- </Link>
+ </NavLink>
);
}
}
-const mapStateToProps = state => {
- const { pathname } = state.router.location;
- return { pathname };
-};
-const mapDispatchToProps = null;
-
-const SideBarRow = connect(
- mapStateToProps,
- mapDispatchToProps
-)(SideBarRowDump);
-
class SideBar extends Component {
render() {
return (