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

@barejs/dashboard-router

v0.5.0

Published

A [react]9https://reactjs.org/ [mui](https://mui.com/) dashboard incorporating [react-router](https://reactrouter.com/).

Downloads

4

Readme

@barejs/dashbourd-router

A [react]9https://reactjs.org/ mui dashboard incorporating react-router.

The dashboard is designed for micro-sites. Two navigation menus are provides: sites and pages. The sites are rendered as simple href links, which provide the menus to navigate between micro-sites. The pages are rendered as react-router-dom links, which provide the menus to navigate within the site.

The props are:

  • title (string): Displayed on the app-bar.
  • basename (string): Passed through to BrowserRouter.
  • sites (array): The array of sites (see the section on sites and pages).
  • pages (array): The array of pages (see the section on sites and pages).
  • routes (node): A react node for the react-router-dom routes.
  • appBarItems (node): A react node for the controls on the app-bar.

sites and pages

Both the sites and pages are arrays of the following shape:

[
  ...

  {
    code: 'app1', // A unique key
    title: 'Application 1', // The menu title.
    description: 'The first application', // Used a a tooltip.
    url: '/example/ui', // The url. An href for the sites, and router link for the pages.
    iconName: 'dashboard' // The name of an icon rendered in mui with <Icon>{iconName}</Icon>
  },

  ...
]

Requirements

You will need to add founts to the index.html. This is used to specify the icon name in the sites and pages props.

<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>

Example

import React from 'react'
import { Route, Redirect } from 'react-router-dom'

import Typography from '@mui/material/Typography'

import DashboardRouter from 'barejs-dashboard-router'
import { Page1, Page2, Page3 } from './pages'

class Site extends React.Component {
  render() {
    return (
      <DashboardRouter
        title="Example Dashboard"
        basename="/example/ui"
        sites={[
          {
            code: 'app1',
            title: 'Application 1',
            description: 'The first application',
            url: '/example/ui',
            iconName: 'dashboard'
          },
          {
            code: 'app2',
            title: 'Application2',
            description: 'The second application',
            url: '/orders/ui',
            iconName: 'album'
          }
        ]}
        pages={[
          {
            code: 'page1',
            title: 'First Page',
            description: 'The first page',
            path: '/first-page',
            iconName: 'shopping_cart'
          },
          {
            code: 'page2',
            title: 'Second Page',
            description: 'The second page',
            path: '/second-page',
            iconName: 'people'
          },
          {
            code: 'page3',
            title: 'Third Page',
            description: 'The third page',
            path: '/third-page',
            iconName: 'agriculture'
          }
        ]}
        routes={
          <>
            <Redirect exact from="/" to="/first-page" />
            <Route
              exact
              path="/first-page"
              render={props => (
                <Page1 title="hello" {...props} {...this.props} />
              )}
            />
            <Route
              exact
              path="/second-page"
              render={props => <Page2 {...props} {...this.props} />}
            />
            <Route
              exact
              path="/third-page"
              render={props => <Page3 {...props} {...this.props} />}
            />
          </>
        }
        appBarItems={
          <Typography component="h4" variant="subtitle1" color="inherit" noWrap>
            John Doe
          </Typography>
        }
      />
    )
  }
}

export default Site