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

@re.d_beard./react-fonticonpicker

v2.1.2

Published

A react component to show a picker element to select font icons or SVG.

Downloads

9

Readme

React FontIconPicker Component

codecov Build Status jest npm version peerDependencies Status GitHub license


FontIconPicker

A react version of fontIconPicker. This is rewritten and is not a wrapper around jQuery version.

With FontIconPicker component you can present an UI where people can pick one or more fonts. In bare-bone it looks like this.

Installation

NPM or YARN

NPM is the preferred way of installation. You can find it from here.

From your project do

npm i @re.d_beard./react-fonticonpicker

Also install the peer dependencies yourself.

npm i react react-dom classnames prop-types react-transition-group

And require the file.

ES6

import FontIconPicker from '@re.d_beard./react-fonticonpicker';

ES5

const FontIconPicker = require('@re.d_beard./react-fonticonpicker');

And use it as React Component. Check the documentation site for more example.

CDN

For some reason, if you'd prefer the CDN, then it is available at unpkg.com.

Place them in your HTML document, along with UMD builds of peer dependencies.

Download Source

We distribute production version of source file through github releases. Head over there and download fonticonpicker.react.zip file.

Usage

Here is an example for use with the create-react-app.

From your project directory do:

yarn add classnames prop-types react-transition-group @fonticonpicker/react-fonticonpicker

Now edit your App.js file to include the following.

import React, { Component } from 'react';
import FontIconPicker from '@re.d_beard./react-fonticonpicker';
import logo from './logo.svg';
import './App.css';
import '@re.d_beard./react-fonticonpicker/dist/fonticonpicker.base-theme.react.css';
import '@re.d_beard./react-fonticonpicker/dist/fonticonpicker.material-theme.react.css';

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      value: 'fipicon-angle-left',
    };
  }
  handleChange = (value) => {
    this.setState({ value });
  }
  render() {
    const props = {
      icons: ['fipicon-angle-left', 'fipicon-angle-right', 'fipicon-angle-up', 'fipicon-angle-down'],
      theme: 'bluegrey',
      renderUsing: 'class',
      value: this.state.value,
      onChange: this.handleChange,
      isMulti: false,
    };
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Welcome to React</h1>
        </header>
        <FontIconPicker {...props} />
      </div>
    );
  }
}

export default App;

create-react-app

This will render a basic FontIconPicker component. For advanced usage, follow the documentation.

Props

| Prop | Type | Required | Default | |------|------|-----------|---------| | icons | object of array or array | yes | N/A | |onChange| func | yes | N/A | | search | object of array or array| no | null| |iconsPerPage| number | no | 20 | |theme | string | no | 'default'| | showCategory| bool | no | true | | showSearch | bool | no | true | | value | array or string | no | null | | isMulti | bool | no | false | | renderUsing | string | no | 'class' | | convertHex | bool | no | true | | renderFunc | func | no | null | | appendTo | string | no | false | | allCatPlaceholder | string | no | 'Show from all' | | searchPlaceholder | string | no | 'Search Icons' | | noIconPlaceholder | string | no | 'No icons found' | | noSelectedPlaceholder | string | no | 'Select icon' |

Development Environment

Development & Build is done with the help of webpack.

First fork and git clone the repo on your machine.

git clone [email protected]:<username>/react-fonticonpicker.git

Now install all the dependencies. Make sure you have nodejs version 9 or higher.

npm install

Now run the server with

npm start

This will open a webpack dev server with hot reload. You can access the server from http://localhost:7770.

Now make changes in the component and see it live. Also add unit tests and integration tests where applicable.

If your changes invalidates snapshots, then make sure to update them too (with good reasons).

When doing a PR, try not to build the docs or the dist. It will create unnecessary merge conflict.

Other npm commands at disposal:

  • npm run test: Runs eslint followed by stylelint and jest tests.
  • npm run start: Runs a dev server with hot reload.
  • npm run docs: Builds the docs for production.
  • npm run build: Builds the UMD & CSS files for distribution.

Credits

React FontIconPicker has been developed by Swashata mainly for in use with eForm. The original idea came from jQuery FontIconPicker by Alessandro Benoit.

None of these would have been possible without the cool Wes Bos 🔥 and his react for beginners course. It is awesome 😉.