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

s8-menu

v0.0.23

Published

A flexible sidebar menu with draggable menu items.

Downloads

6

Readme

s8-menu

A flexible, drag-and-drop enabled menu component for react.

This component is in testing mode and is not ready for prime-time.

Basic menu

import React from 'react';
import { Menu, MenuItem, DNDMenueItem } from s8-menu';

// FontAwesome must be included in your page to use these icons
const bulbIcon = <i style={{color:'#efd75f'}} className="fas fa-lightbulb"></i>;
const folderIcon = <i style={{color:'lightblue'}} className="fas fa-folder"></i>;
const folderOpenIcon = <i style={{color:'lightblue'}} className="fas fa-folder-open"></i>;

const MyMenu = ()=>
      <Menu>
        <MenuItem icon={folderIcon}
                  openIcon={folderOpenIcon}
                  backgroundColor={'#e1f1ff'}
                  textColor={'green'}
                  title="Folder"
                  onItemClick={()=>console.log('item click')}
                  onIconClick={()=>console.log('icon click')}
        >
          <MenuItem icon={bulbIcon} title={'Scene1'}/>
          <MenuItem icon={bulbIcon} title={'Scene2'}/>
          <MenuItem icon={bulbIcon} title={'Scene3'}/>
        </MenuItem>
        <MenuItem icon={bulbIcon} title={'Scene4'}/>
        <MenuItem icon={bulbIcon} title={'Scene5'}/>
      </Menu>

Drag & Drop Menu

import React from 'react';
import { Menu, MenuItem, DNDMenueItem } from s8-menu';
import HTML5Backend from 'react-dnd-html5-backend';
import { NativeTypes } from 'react-dnd-html5-backend';
import { DragDropContextProvider } from 'react-dnd';

// FontAwesome must be included in your page to use these icons
const bulbIcon = <i style={{color:'#efd75f'}} className="fas fa-lightbulb"></i>;
const folderIcon = <i style={{color:'lightblue'}} className="fas fa-folder"></i>;
const folderOpenIcon = <i style={{color:'lightblue'}} className="fas fa-folder-open"></i>;

const MyMenu = ()=>
    <DragDropContextProvider backend={HTML5Backend}> <!-- This should happen at the root level ofyour app -->
      <Menu>
        <DNDMenueItem icon={folderIcon} dropTypes={[NativeTypes.FILE, 'media','action', NativeTypes.TEXT, NativeTypes.URL]} onDropped={()=>console.log('dropped')} openIcon={folderOpenIcon} title="Accepts Anything">

          <DNDMenueItem icon={bulbIcon} title={'Scene3'}/>
          <DNDMenueItem icon={folderIcon} dropTypes={[NativeTypes.FILE, 'media', NativeTypes.TEXT, NativeTypes.URL]} onDropped={item=>console.log(item)} openIcon={folderOpenIcon} title="Nested Droppable"/>
          <DNDMenueItem icon={folderIcon} openIcon={folderOpenIcon} title="Deep Folder">
            <DNDMenueItem icon={bulbIcon} title={'Scene6'}/>
            <DNDMenueItem icon={bulbIcon} title={'Scene7'}/>
            <DNDMenueItem icon={bulbIcon} title={'Scene8'}/>
          </DNDMenueItem>
        </DNDMenueItem>
        <DNDMenueItem icon={bulbIcon} dragType={''} dropTypes={NativeTypes.TEXT}  onDrop={()=>console.log('Text dropped')} title={'Drop Text Here'}/>
        <DNDMenueItem icon={bulbIcon} css={'&:hover{background-color: green}'} title={'Scene4'}/>
        <DNDMenueItem icon={bulbIcon} dragType={'media'} payload={5} title={'Scene5'}/>
        <DNDMenueItem icon={bulbIcon} dragType={'action'} cuelist={5} cue={4} payload={1} title={'Scene5'}/>
      </Menu>
    <DragDropContextProvider backend={HTML5Backend}>

Custom Render Function

import React from 'react';
import { Menu, MenuItem, DNDMenueItem } from s8-menu';

// FontAwesome must be included in your page to use these icons
const bulbIcon = <i style={{color:'#efd75f'}} className="fas fa-lightbulb"></i>;

const cuelistRenderer = ({title,icon, cuelist, cue, onPlay})=>
    <div style={{marginBottom:12,paddingBottom:8, display:'flex', borderBottom: '1px solid #EEE'}}>
      <div style={{fontSize: 32, color: '#d0cc2a', paddingRight:8}} onClick={()=>onPlay()}>{icon}</div>
      <div>
        {title}
         <br/>
         <span style={{fontSize: '.8em', color: '#888'}}>QL:{cuelist}/ Q:{cue}</span>
      </div>
    </div>;

const MyMenu = ()=>
    <Menu>
        <MenuItem icon={bulbIcon} cuelist={5} cue={4} payload={1} render={cuelistRenderer} onPlay={()=>console.log('playing')} title={'Scene5'}/>
        <MenuItem icon={bulbIcon} cuelist={5} cue={3} payload={1} render={cuelistRenderer} title={'Scene4'}/>
        <MenuItem icon={bulbIcon} cuelist={5} cue={2} payload={1} render={cuelistRenderer} title={'Scene3'}/>
        <MenuItem icon={bulbIcon} cuelist={5} cue={1} payload={1} render={cuelistRenderer} title={'Scene2'}/>
    </Menu>