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-dynamic-sidenavbar

v1.0.5

Published

A react responsive dynamic ease to use side-navbar with many more features

Downloads

20

Readme

React Dynamic Side Navbar

React Dynamic Side Navbar provides components for creating responsive, dynamic multi level dropdown and search facility with many more features.

Installation

yarn

yarn add react-dynamic-sidenavbar

npm

npm install react-dynamic-sidenavbar

Live Preview

Screenshot

react-dynamic-sidenavbar react-dynamic-sidenavbar react-dynamic-sidenavbar react-dynamic-sidenavbar

Usage

Essential Import

import React, { useState } from "react";
import NavBarComponent from "react-dynamic-sidenavbar";
const [openNav, setOpenNav] = useState(false);
const expandableTime = ".5s";
Dummy Data (kindly follow data carefully)
const data = [
  {
    id: 1, // id will increase in next object
    icon: <MdOutlineFastfood />,
    isHovering: false,
    visible: false,
    name: "Router Link Example",
    sub: [
      {
        isHovering: false, // no change
        visible: false, // no change
        name: "Blogs", // drop down text
        sub: [], // if any sub dropdown available, place the object here, its explain in next object, follow
        link: "/blogs", // to link
      },
      {
        isHovering: false,
        visible: false,
        name: "Contact",
        sub: [],
        link: "/contact",
      },
    ],
  },
  {
    id: 2,
    icon: <MdOutlineFastfood />,
    isHovering: false,
    visible: false,
    name: "Cuisine",
    sub: [
      {
        isHovering: false,
        visible: false,
        name: "Indian",
        sub: [
          {
            isHovering: false,
            visible: false,
            name: "Fast food",
            sub: [
              {
                isHovering: false,
                visible: false,
                name: "Chole Bhature",
                sub: [],
              },
              {
                isHovering: false,
                visible: false,
                name: "Samosas (Deep-Fried Potato/Veggie Dumpling)",
                sub: [],
              },
              {
                isHovering: false,
                visible: false,
                name: "Pav Bhaji",
                sub: [],
              },
              { isHovering: false, visible: false, name: "Pakora", sub: [] },
              { isHovering: false, visible: false, name: "Pasta", sub: [] },
            ],
          },
          {
            visible: false,
            name: "Main Course",
            sub: [
              {
                visible: false,
                name: "Chicken Makhani (Butter Chicken)",
                sub: [],
              },
              {
                visible: false,
                name: "Chana masala",
                sub: [],
              },
              {
                visible: false,
                name: "Aloo Gobi (Potato and Cauliflower)",
                sub: [],
              },
              {
                visible: false,
                name: "Naan (Flatbread)",
                sub: [],
              },
              {
                visible: false,
                name: "Matar Paneer (Peas and Cooked Cottage Cheese)",
                sub: [],
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: 3,
    icon: <MdOutlineFastfood />,
    isHovering: false,
    visible: false,
    name: "Cuisine1",
    sub: [
      {
        isHovering: false,
        visible: false,
        name: "Indian",
        sub: [
          {
            isHovering: false,
            visible: false,
            name: "Fast food",
            sub: [
              {
                isHovering: false,
                visible: false,
                name: "Chole Bhature",
                sub: [],
              },
              {
                isHovering: false,
                visible: false,
                name: "Samosas (Deep-Fried Potato/Veggie Dumpling)",
                sub: [],
              },
              {
                isHovering: false,
                visible: false,
                name: "Pav Bhaji",
                sub: [],
              },
              { isHovering: false, visible: false, name: "Pakora", sub: [] },
              { isHovering: false, visible: false, name: "Pasta", sub: [] },
            ],
          },
          {
            visible: false,
            name: "Main Course",
            sub: [
              {
                visible: false,
                name: "Chicken Makhani (Butter Chicken)",
                sub: [],
              },
              {
                visible: false,
                name: "Chana masala",
                sub: [],
              },
              {
                visible: false,
                name: "Aloo Gobi (Potato and Cauliflower)",
                sub: [],
              },
              {
                visible: false,
                name: "Naan (Flatbread)",
                sub: [],
              },
              {
                visible: false,
                name: "Matar Paneer (Peas and Cooked Cottage Cheese)",
                sub: [],
              },
            ],
          },
        ],
      },
    ],
  },
];

Main Component

<NavBarComponent
  navbarType="slide_page" // For Slide The Main Page Content to The Right
  navbarType="fixed_page" // Open the Sidebar Navigation Over a Part of the Content
  header="normal" // to set default symbol
  header="logo" // to set logo
  logo={logo} // import image as your choice if `header="logo"`
  dropDownList={data} // * essential for multichild dropdown
  isOpenNav={setOpenNav} // from state
  openNav={openNav} // from state
  backgroundColor="#0d6efd"
  backgroundOpacity={0.9}
  itemColor="#d3d7db"
  hoverItemColor="white"
  expandIconColor="white"
  expandIconDeviderColor="white"
  searchIconColor="white"
  expandableTime={expandableTime}
  searchHighlightBackgroundColor="#eb0808"
/>

Shortcut keys

ctrl + alt + o --- to open
ctrl + alt + c --- to minimize

~~~ Example Usage ~~~

★ For Slide The Main Page Content to The Right

<div
  style={{
    display: "flex",
    width: "100vw",
    height: "100vh",
  }}
>
  <NavBarComponent
    navbarType="slide_page"
    header="logo"
    logo={logo}
    dropDownList={data}
    isOpenNav={setOpenNav}
    openNav={openNav}
    backgroundColor="#0d6efd"
    backgroundOpacity={0.9}
    itemColor="#d3d7db"
    hoverItemColor="white"
    expandIconColor="white"
    expandIconDeviderColor="white"
    searchIconColor="white"
    expandableTime={expandableTime}
    searchHighlightBackgroundColor="#eb0808"
  />
  <div
    className={openNav ? "openSidenavWidth1" : "closeSidenavWidth1"}
    style={
      openNav
        ? {
            width: "100%",
            padding: "5px 10px",
            transition: expandableTime,
          }
        : {
            width: "100%",
            padding: "5px 10px",
            transition: expandableTime,
          }
    }
  >
    \\ ............. your code .............. \\
  </div>
</div>
Essential css
.openSidenavWidth1 {
  width: calc(100vw - 150px) !important;
}

.closeSidenavWidth1 {
  width: calc(100vw - 30px) !important;
}

@media (min-width: 575px) {
  .openSidenavWidth1 {
    width: calc(100vw - 200px) !important;
  }
}

@media (min-width: 767px) {
  .openSidenavWidth1 {
    width: calc(100vw - 300px) !important;
  }

  .closeSidenavWidth1 {
    width: calc(100vw - 40px) !important;
  }
}

★ Open the Sidebar Navigation Over a Part of the Content

<div
  style={{
    width: "100%",
    height: "100vh",
  }}
>
  <NavBarComponent
    navbarType="fixed_page"
    header="normal"
    dropDownList={data}
    isOpenNav={setOpenNav}
    openNav={openNav}
    backgroundColor="black"
    backgroundOpacity={1}
    itemColor="#d3d7db"
    hoverItemColor="red"
    expandIconColor="red"
    expandIconDeviderColor="red"
    searchIconColor="white"
    expandableTime={expandableTime}
    searchHighlightBackgroundColor="#eb0808"
  />
  <div style={{ width: "100%", padding: "5px 10px", zIndex: 1 }}>
    \\ ............. your code .............. \\
  </div>
</div>

License

ISC © Sayan Pandab