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

@clipmx/drawer

v0.3.0

Published

Core Clip Drawer

Downloads

18

Readme

Clip Button

Wrapper of MuiDrawer that adds the optional funciontality of rendering a MuiList through the items prop. Each item could have the followint properties:

  • label (required): Rendered using a ListItemText component, should be unique.
  • icon (optional): Rendered using a ListItemIcon component, you must provide an Icon or SvgIcon node.
  • divider (optional): Mandates to render a Divider, use 'above'|'below' to specify where to render it.
  • action (optional): A function which is called with the item clicked, if you return false, the item won't be marked as active.

You can style each element of the rendered list using the following classes (use withStyles from mui to set them):

  • listItemRoot: Styles for the root class of the ListItem component.
  • activeListItemRoot: Styles for the root class of the ListItem component when active.
  • listItemIconRoot: Styles for the root class of the ListItemIcon component.
  • activeListItemIconRoot: Styles for the root class of the ListItemIcon component when active.
  • listItemTextRoot: Styles for the root class of the ListItemText component.
  • activeListItemTextRoot: Styles for the root class of the ListItemText component when active.
  • listItemTextPrimary: Styles for the primary class of the ListItemText component.
  • activeListItemTextPrimary: Styles for the primary class of the ListItemText component when active.

To specify a general action for when items are clicked, you can use the itemsAction prop, which will receive the item been clicked, this function won't be executed when clicking an item for which you provided an action callback and like with that other funciton, if you return false, then the item won't be marked as active.

To specify the initial active item, you can pass the activeItem prop, specifying the index of it or the label of the item.

If you don't want to use this auto items rendering, you can still provide the children of the Drawer, as if you where using the normal MuiDrawer, if you provide both the children and items props, the List (items) component will be rendered as the first child of the drawer.

Installation

npm install @clipmx/drawer --save

Usage

import React from 'react';
import ResponsiveDrawer from '@clipmx/drawer';

const drawerItems = [
  {
    name: 'First item',
    icon: <FirstItemIcon />,
    linkPath: '/go/to/firstItemPath',
  },
  {
    name: 'Second item',
    icon: <SecondItemIcon />,
    linkPath: '/go/to/secondItemPath',
  },
  {
    name: 'Third item',
    icon: <ThirdItemIcon />,
    linkPath: '/go/to/thirdItemPath',
  },
];
const MyComponent = () => (
  <div>
    <Drawer items={drawerItems} />
  </div>
);

export default MyComponent;

Props

This is a wrapper of the Material-UI drawer, so you can use any props that Material-UI supports.