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-sidebar-web

v0.0.16-beta

Published

Simple gmail like sidebar for modern browsers.

Downloads

9

Readme

react-sidebar-web

Simple gmail-like, customizable sidebar using react, with support for react router. Targetted only for desktop viewports and modern browsers(chrome). Optimization for smaller viewports to be done on future release.

Sample Application deployed at https://react-sidebar-sigma.vercel.app/

Getting Started

Installing the package:

npm install --save react-sidebar-web

Or

yarn add react-sidebar-web

Important: styled-components (>= 5.0.0) needs to be installed and enabled in project in order to get react-sidebar-web running.

Components styles can be customized by setting the following css-custom variables:

--transition-settings-1: 0.2s ease;
--box-shadow-6dp: 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12), 0 3px 5px -1px rgba(0,0,0,0.20);
--box-shadow-9dp: 0 9px 12px 1px rgba(0,0,0,0.14), 0 3px 16px 2px rgba(0,0,0,0.12), 0 5px 6px -3px rgba(0,0,0,0.20);

--light-primary-color: #BBDEFB;
--on-light-primary-color: #000;
--primary-accent: #009688;
--on-primary-accent: #FFF;
--primary-color: #2196F3;
--on-primary-color: #FFF;
--primary-surface: #FFF;
--on-primary-surface: #000;
--icon-container-size: 2rem;
--sidebar-z-index: 400;
--header-z-index: 500;
--sidebar-max-width: 20vw;

Rendering the Sidebar:

Sidebar accepts a two props defaultExpanded and hideFooter. When defaultExpanded=true, sidebar stays persistent and pushes the main content to right. When hideFooter=true, the toggle between persistent and non persistent mode is hidden.

Sample sidebar

import {Sidebar, NavItemsContainer, NavItem} from 'react-sidebar'

...

<Sidebar>
    <NavItemsContainer>
        <NavItem to='/' label='Home' exact />
        <NavItem to='/explore' label='Explore' exact />
        <NavItem label='Playlists'>
            <NavItem to='/subscription-1' label='Playlist-1' exact />
            <NavItem to='/subscription-2' label='Playlist-2' exact />
        </NavItem>
    </NavItemsContainer>
</Sidebar>
  • Sidebar is the root container component for rendering the sidebar
  • NavItemsContainer is the container for all the nav items and must be used as the parent component for the nav items
  • NavItem is a wrapper to React Router's NavLink component

NavItem can be used in 2 ways:

  • When NavItem is not passed any children, it acts as a link to a route and following props are required:
    • to - Passed down to NavLink: Link to route
    • label - Text to be displayed on Nav item
    • icon - Icon to be displayed before the nav item label
  • When NavItem is passed with children, it acts as expandable tab group, with NavItems as children. Any react component passed as children will be rendered within the group, and is collapsed by default. When NavItem is used as group, only label prop is required to be passed.

Header

To add the header component:

import {Header} from  'react-sidebar'
...
<Header logo={<BrandIcon width='1rem' />} logoText='Brand'>
...React Components to be rendered on Header
</Header>
Customizable Styles on Header:

Background surface and text color can be customized by setting the following css custom variables:

--primary-surface: #FFF;
--on-primary-surface: #000;
Props:
  • logo: Pass logo icon to be displayed as react component
  • logoText: Logo text - Will be displayed in h4
  • children: Pass any links/searchbar that needs to displayed in header as react component