Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help: Use fluxible-router #1965

Closed
johankvint opened this issue Oct 22, 2015 · 3 comments
Closed

Help: Use fluxible-router #1965

johankvint opened this issue Oct 22, 2015 · 3 comments
Labels
component: menu This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@johankvint
Copy link

Hi,

When using the LeftNav I can only send in an array of menu items and when using fluxible-router I need the to be rendered with the fluxible-routers NavLink.
Anyone got this to work?

Regards

@johankvint johankvint changed the title Use fluxible-router Help: Use fluxible-router Oct 22, 2015
@johankvint
Copy link
Author

In case anyone else have the same question this is my own answer:

import React from 'react';
import { navigateAction } from 'fluxible-router';
import { LeftNav } from 'material-ui';

class LeftNavComponent extends React.Component {

  static contextTypes = {
      executeAction: PropTypes.func.isRequired,
      getStore: PropTypes.func.isRequired,
  }

  _onChange = (event, selectedIndex, menuItem) => {
    const routeStore = this.context.getStore("RouteStore");
    const url = routeStore.makePath(menuItem.route, {});

    this.context.executeAction(navigateAction, {
        url: url
    });
  }

  toggle = () => {
    this.refs.leftNav.toggle();
  }

  render() {
    const menuItems = [
      {route: 'home', text: 'Home'},
    ];

    return (
      <LeftNav
        ref="leftNav"
        docked={false}
        isInitiallyOpen={false}
        menuItems={menuItems}
        onChange={this._onChange} />
    );
  }
}

export default LeftNavComponent;

@oliviertassinari
Copy link
Member

@cybercomkvint Should we close this issue?

@johankvint
Copy link
Author

Yes you can do that if you want.
Thanks.

On 23 Oct 2015 4:53 p.m., Olivier Tassinari notifications@github.com wrote:

@cybercomkvinthttps://github.com/cybercomkvint Should we close this issue?

Reply to this email directly or view it on GitHubhttps://github.com//issues/1965#issuecomment-150596752.

@zannager zannager added support: question Community support but can be turned into an improvement component: menu This is the name of the generic UI component, not the React module! labels Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

4 participants