summaryrefslogtreecommitdiff
path: root/src/components
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
parent580a61687ba137734d80589319f127539657a443 (diff)
deps: get rid of the deprecated react-router-redux
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Root.js7
-rw-r--r--src/components/SideBar.js28
2 files changed, 9 insertions, 26 deletions
diff --git a/src/components/Root.js b/src/components/Root.js
index 90144ff..7c6622a 100644
--- a/src/components/Root.js
+++ b/src/components/Root.js
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
-import { ConnectedRouter } from 'react-router-redux';
-import { Route } from 'react-router-dom';
+import { Router, Route } from 'react-router-dom';
import { hot } from 'react-hot-loader';
import SideBar from 'c/SideBar';
@@ -33,7 +32,7 @@ import s0 from './Root.module.scss';
const Root = ({ store, history }) => (
<Provider store={store}>
- <ConnectedRouter history={history}>
+ <Router history={history}>
<div className={s0.app}>
<APIDiscovery />
<Route path="/" component={SideBar} />
@@ -45,7 +44,7 @@ const Root = ({ store, history }) => (
<Route exact path="/proxies" component={Proxies} />
</div>
</div>
- </ConnectedRouter>
+ </Router>
</Provider>
);
// <Route exact path="/__0" component={StyleGuide} />
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 (