diff --git a/static/src/js/components/navbar/item.js b/static/src/js/components/navbar/item.js index 81a4694..f2560c9 100644 --- a/static/src/js/components/navbar/item.js +++ b/static/src/js/components/navbar/item.js @@ -1,6 +1,30 @@ import React from 'react'; +import Reverser from '../../helpers/reverser'; + export default class Item extends React.Component { + constructor() { + super(); + this.state = { + url: '#' + }; + } + + componentDidMount() { + if (!this.props.href && !this.props.ident) { + return; + } + + if (this.props.href) { + this.setState({url: this.props.href}); + } else { + Reverser(this.props.ident, this.props.args) + .then(function (url) { + this.setState({ url }); + }.bind(this)) + .catch(console.log); + } + } render() { let icon; if (this.props.icon) { @@ -9,7 +33,7 @@ export default class Item extends React.Component { ); } return ( -
  • {icon}{this.props.children}
  • +
  • {icon}{this.props.children}
  • ); } } diff --git a/static/src/js/components/navbar/navbar.js b/static/src/js/components/navbar/navbar.js index 4bb9214..d107b2f 100644 --- a/static/src/js/components/navbar/navbar.js +++ b/static/src/js/components/navbar/navbar.js @@ -18,7 +18,7 @@ export default class NavBar extends React.Component {