Skip to content

Commit

Permalink
feat(RmNav): set 'links' class property
Browse files Browse the repository at this point in the history
iterate over the links array and set each NavLink
  • Loading branch information
aneurysmjs committed Jan 10, 2018
1 parent 8abd1c5 commit 4f984ce
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"add-asset-html-webpack-plugin": "2.1.1",
"babel-core": "6.26.0",
"babel-eslint": "^8.2.1",
"babel-eslint": "8.2.1",
"babel-loader": "7.1.2",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-class-properties": "6.24.1",
Expand Down Expand Up @@ -108,6 +108,7 @@
"font-awesome": "4.7.0",
"global": "4.3.2",
"lodash.throttle": "4.1.1",
"node-uuid": "1.4.8",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-medium-editor": "1.8.1",
Expand Down
41 changes: 25 additions & 16 deletions src/containers/RmNav/RmNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import { NavLink } from 'react-router-dom';
import { func, string, bool } from 'prop-types';
import { connect } from 'react-redux';
import { v4 } from 'node-uuid';

import RmSearcher from '../../components/RmSearcher/RmSearcher';

Expand All @@ -17,6 +18,19 @@ class RmNav extends Component {
this.setState({searchTerm});
};

links = [
{
id: v4(),
path: 'home',
name: 'Home'
},
{
id: v4(),
path: 'movies',
name: 'Movies'
}
];

render() {

const {
Expand Down Expand Up @@ -54,22 +68,17 @@ class RmNav extends Component {
</button>
<div className="collapse navbar-collapse">
<ul className="navbar-nav mr-auto">
<li className="nav-item">
<NavLink
to="/"
activeClassName="active"
className="nav-link">
Home
</NavLink>
</li>
<li className="nav-item">
<NavLink
to="/movies"
activeClassName="active"
className="nav-link">
Movies
</NavLink>
</li>
{this.links.map(({ path, name, id}) => (
<li key={id} className="nav-item">
<NavLink
to={`/${path}`}
key={id}
activeClassName="active"
className="nav-link">
{name}
</NavLink>
</li>
))}
</ul>
<div className="form-inline">
{space}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5897,7 +5897,7 @@ [email protected]:
sass-graph "^2.1.1"
stdout-stream "^1.4.0"

node-uuid@~1.4.7:
node-uuid@^1.4.8, node-uuid@~1.4.7:
version "1.4.8"
resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907"

Expand Down

0 comments on commit 4f984ce

Please sign in to comment.