@patternfly/react-core#Nav JavaScript Examples

The following examples show how to use @patternfly/react-core#Nav. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: admin.js    From ibutsu-server with MIT License 6 votes vote down vote up
render() {
    const navigation = (
      <Nav onSelect={this.onNavSelect} theme="dark" aria-label="Nav">
        <NavList>
          <li className="pf-c-nav__item">
            <NavLink to="/admin" className="pf-c-nav__link" activeClassName="pf-m-active" exact>Admin Home</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/admin/users" className="pf-c-nav__link" activeClassName="pf-m-active">Users</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/admin/projects" className="pf-c-nav__link" activeClassName="pf-m-active">Projects</NavLink>
          </li>
        </NavList>
      </Nav>
    );

    return (
      <React.Fragment>
        <IbutsuPage eventEmitter={this.eventEmitter} navigation={navigation} title="Administration | Ibutsu">
          <Switch>
            <Route path="/admin" component={AdminHome} exact />
            <Route path="/admin/users" component={UserList} exact />
            <Route path="/admin/users/:id" component={UserEdit} />
            <Route path="/admin/projects" component={ProjectList} exact />
            <Route path="/admin/projects/:id" component={ProjectEdit} exact />
          </Switch>
        </IbutsuPage>
      </React.Fragment>
    );
  }
Example #2
Source File: profile.js    From ibutsu-server with MIT License 6 votes vote down vote up
render() {
    const navigation = (
      <Nav onSelect={this.onNavSelect} theme="dark" aria-label="Nav">
        <NavList>
          <li className="pf-c-nav__item">
            <NavLink to="/profile" className="pf-c-nav__link" activeClassName="pf-m-active" exact>Profile</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/profile/tokens" className="pf-c-nav__link" activeClassName="pf-m-active">Tokens</NavLink>
          </li>
        </NavList>
      </Nav>
    );

    return (
      <React.Fragment>
        <IbutsuPage eventEmitter={this.eventEmitter} navigation={navigation} title="Profile | Ibutsu">
          <Switch>
            <Route
              path="/profile"
              exact
              render={routerProps => <UserProfile eventEmitter={this.eventEmitter} {...routerProps} />}
            />
            <Route
              path="/profile/tokens"
              exact
              render={routerProps => (
                <UserTokens eventEmitter={this.eventEmitter} {...routerProps} />
              )}
            />
          </Switch>
        </IbutsuPage>
      </React.Fragment>
    );
  }
Example #3
Source File: Header.js    From operate-first.github.io-old with GNU General Public License v3.0 6 votes vote down vote up
TopNav = ({ location }) => {
  const navItems = [
    ['data-science', 'Data Science'],
    ['community-handbook', 'Community Handbook '],
    ['blueprints', 'Blueprints'],
    ['community', 'Community'],
  ];

  return (
    <Nav variant="horizontal">
      <NavList>
        {navItems.map(([id, label]) => (
          <NavItem key={id} itemId={id} isActive={location.pathname.startsWith(`/${id}/`)}>
            <Link to={`/${id}/`}>{label}</Link>
          </NavItem>
        ))}
      </NavList>
    </Nav>
  );
}
Example #4
Source File: app.js    From ibutsu-server with MIT License 5 votes vote down vote up
render() {
    document.title = 'Ibutsu';
    const { views } = this.state;
    const navigation = (
      <Nav onSelect={this.onNavSelect} theme="dark" aria-label="Nav">
        <NavList>
          <li className="pf-c-nav__item">
            <NavLink to="/" className="pf-c-nav__link" activeClassName="pf-m-active" exact>Dashboard</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/runs" className="pf-c-nav__link" activeClassName="pf-m-active">Runs</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/results" className="pf-c-nav__link" activeClassName="pf-m-active">Test Results</NavLink>
          </li>
          <li className="pf-c-nav__item">
            <NavLink to="/reports" className="pf-c-nav__link" activeClassName="pf-m-active">Report Builder</NavLink>
          </li>
          {views && views.map(view => (
            <li className="pf-c-nav__item" key={view.id}>
              <NavLink to={`/view/${view.id}`} className="pf-c-nav__link" activeClassName="pf-m-active">{view.title}</NavLink>
            </li>
          ))}
        </NavList>
      </Nav>
    );

    return (
      <React.Fragment>
        <IbutsuPage eventEmitter={this.eventEmitter} navigation={navigation}>
          <Switch>
            <Route
              path="/"
              exact
              render={routerProps => (
                <Dashboard eventEmitter={this.eventEmitter} {...routerProps} />
              )}
            />
            <Route
              path="/runs"
              exact
              render={routerProps => (
                <RunList eventEmitter={this.eventEmitter} {...routerProps} />
              )}
            />
            <Route
              path="/results"
              exact
              render={routerProps => (
                <ResultList eventEmitter={this.eventEmitter} {...routerProps} />
              )}
            />
            <Route
              path="/reports"
              exact
              render={routerProps => (
                <ReportBuilder eventEmitter={this.eventEmitter} {...routerProps} />
              )}
            />
            <Route path="/runs/:id" component={Run} />
            <Route path="/results/:id" component={Result} />
            <Route path="/view/:id" component={View} />
          </Switch>
        </IbutsuPage>
      </React.Fragment>
    );
  }
Example #5
Source File: NavSidebar.js    From operate-first.github.io-old with GNU General Public License v3.0 5 votes vote down vote up
NavSidebar = ({ isNavOpen, location }) => {
  const navData = useStaticQuery(
    graphql`
      {
        navData {
          navItems {
            id
            label
            href
            links {
              id
              label
              remote
              href
            }
          }
        }
      }
    `
  ).navData.navItems;

  // No Sidebar for mainpage
  if (location.pathname === '/') {
    return <div />;
  }

  return (
    <PageSidebar
      isNavOpen={isNavOpen}
      nav={
        <Nav className="nav" theme="dark" aria-label="Nav">
          <NavList>
            {location &&
              navData.map((node) => <NavGroup key={node.id} {...node} location={location} />)}
          </NavList>
        </Nav>
      }
      theme="dark"
    />
  );
}