This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

react-filter-picker

0.1.1 • Public • Published

react-filter-picker

React component which include menu bar with picker

NPM Build Status

Install

npm install --save react-filter-picker
yarn add react-filter-picker

Usage

import React, { Component } from 'react'
 
import Filter from 'react-nectar-filter'
 
const filterData = {
  size: [
    {
      id: "2x3",
      title: "2' X 3'",
    },
    {
      id: "3x5",
      title: "3' X 5'",
    },
  ],
  color: [
    {
      id: "blue",
      title: "Blue"
    },
    {
      id: "black",
      title: "Black"
    },
  ],
}
 
class Example extends Component {
    constructor(props) {
        super(props);
    
        this.state = {
          appliedFilters: {}
        };
    
        this.filterRef = React.createRef();
    }
 
  handleFilterChange = appliedFilters => {
    this.setState({ appliedFilters });
  }
 
  handleClearAllClick = () => {
    this.filterRef.current.clearAll();
  }
  render () {
    <Filter
      ref={this.filterRef}
      filterData={filterData}
      onChange={this.handleFilterChange}
    />
  }
}

Development

Building tool create-react-library

Local development is broken into two parts (ideally using two tabs).

First, run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

 npm start # runs rollup with watch flag 

The second part will be running the example/ create-react-app that's linked to the local version of your module.

# (in another tab)  
cd example
npm start # runs create-react-app dev server  

Now, anytime you make a change to your library in src/ or to the example app's example/src, create-react-app will live-reload your local dev server so you can iterate on your component in real-time.

Publishing to NPM

npm publish

This builds cjs and es versions of your module to dist/ and then publishes your module to npm.

Make sure that any npm modules you want as peer dependencies are properly marked as peerDependencies in package.json. The rollup config will automatically recognize them as peers and not try to bundle them in your module.

License

MIT © frayeralex

Package Sidebar

Install

npm i react-filter-picker

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

422 kB

Total Files

6

Last publish

Collaborators

  • alexboyko