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-data-menu

v1.1.2

Published

Smart data-driven menu rendered in an overlay

Downloads

162

Readme

NPM

NPM

React Data Menu

Smart data-driven menu rendered in an overlay.

Hints-based aligning with custom renderers and factories.

Never clipped by other components or screen edges.

Data Menu!

:gear: Maintainance

React 0.14: https://github.com/dkozar/react-data-menu/commits/react-0.14

:tv: Demo

http://dkozar.github.io/react-data-menu/

:tv: Video

https://www.youtube.com/watch?v=TvtC0xsn6ig

:zap: Usage

// ES6
import React, { Component } from 'react';
import { LinkRenderer } from './renderers/LinkRenderer.js';
import { Menu } from 'react-data-menu';

function callback(item) {
    console.log('item clicked', item);
}

export class App extends Component {

    constructor(props) {
        super(props);

        this.state = {
            position: {
                x: 100,
                y: 100
            },
            items: {
                type: 'label',
                title: 'Menu Popup 1'
            }, '-', {
                title: 'Menu item 1-1',
                callback: callback,
                items: [{ // sub-menu
                    title: 'Menu Popup 2'
                }, '-', {
                    title: 'Menu item 2-1',
                    callback: callback,
                    items: [{ // sub-sub-menu
                        title: 'Menu Popup 3'
                    }, '-', {
                        title: 'Menu item 3-1'
                    }]
                }]
            }, {
                title: 'Menu item 1-2'
            }, '-', {
                 type: 'link',
                 title: 'Give me the stars!',
                 url: 'https://github.com/dkozar/react-data-menu/stargazers',
                 target: '_blank'
            }];
        };
    }

    render() {
        var renderers = {
            'link': LinkRenderer
        };
    
        return (
            <Menu items={this.state.items} position={this.state.position} renderers={renderers} />
        );
    }
}

render(<App />, document.body);

:truck: Installation

Option A - use it as NPM plugin:

npm install react-data-menu --save

This will install the package into the node_modules folder of your project.

Option B - download the project source:

git clone https://github.com/dkozar/react-data-menu.git
cd react-data-menu
npm install

npm install will install all the dependencies (and their dependencies) into the node_modules folder.

Then, you should run one of the builds.

:factory: Builds

:rocket: Hot-loader development build

npm start
open http://localhost:3000

This will give you the build that will partially update the browser via webpack whenever you save the edited source file.

Additionally, it will keep the React component state intact.

For more info on React hot-loader, take a look into this fantastic video.

:helicopter: Demo build

npm run demo

This should build the minified demo folder (it's how the demo is built).

npm run debug

This should build the non-minified demo folder (for easier debugging).

You could install the http-server for running demo builds in the browser:

npm install http-server
http-server

:steam_locomotive: Additional builds

npm run build

Runs Babel on source files (converting ES6 and React to JS) and puts them into the build folder.

npm run dist

Builds the webpackUniversalModuleDefinition and puts it into the dist folder.

npm run all

Runs all the builds: build + dist + demo.

npm run test

Runs the tests.

:thumbsup: Thanks to:

:rocket: React Transform Boilerplate for the workflow.

Downloads!