npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-strapmenu

v0.1.2

Published

Bootstrap dropdown menu generator for react-router

Downloads

21

Readme

#react-strapmenu Bootstrap dropdown menu generator for react-router

###but why? It's just another automated everyday-task. A lot kittens developing navigation menus synced with routes, every single day.

###but how? It basically loops through the given routes to generate cute little dropdown menu. like dis ;

react-strapmenu


###teach me

yarn add react-strapmenu

- or -

npm install react-strapmenu --save

then, in your entry point - where the routes are defined - you'll need to expose which routes you want to include in menu. like dis ;

Index.js


import Route from 'react-router/lib/Route'
import Router from 'react-router/lib/Router'
import browserHistory from 'react-router/lib/browserHistory'

ReactDOM.render((
  <Router history={browserHistory}>
    <Route name='Root' path='/' component={App} >
      <Route path='/beers' name='Beers' icon='ion-beer' exposed component={Beers}/>
      <Route path='/paws' name='Paws' icon='ion-ios-paw' exposed component={Paws}/>
      <Route path='/octocats' name='Octocats' icon='ion-social-octocat' exposed component={Octocats} divideAfter>
        <Route path='/octocats/:id' name='Paws2' component={OctocatDetail} />
      </Route>
      <Route path='/logout' name='Logout' icon='ion-power' component={Logout} exposed />
    </Route>
  </Router>
),
  document.getElementById('root')
);

####Route props

  • exposed: indicates that you want it in the menu.
  • name: name of your menu item.
  • icon: icon of your menu item. accepts any css icon class name. ex. ion-users , fa fa-users , glyphicon glyphicon-users
  • divideAfter: set menu item divider after that item, exposed or not.

App.js

import { Navbar, Nav, Button } from 'react-bootstrap'
import { LinkContainer } from 'react-router-bootstrap'
import NavbarGenerator from 'react-strapmenu'

class App extends Component {
  render() {
    return (
      <div className="App">

        <Navbar fixedTop inverse >
        
          <Navbar.Collapse>
            <Nav pullRight>
              <NavbarGenerator routes={this.props.routes} />
            </Nav>
          </Navbar.Collapse>
 
        </Navbar>

        <div className="App-header">Insert content here</div>
    );
  }
}

export default App;

####Component props

  • routes (required): you have to pass the routes to the component, which can be passed by this.props.routes
  • dropdownProps: props you want to pass to [<NavDropdown />][https://react-bootstrap.github.io/components.html#navs-dropdown]

TODO