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

@skagami/react-fontawesome

v1.0.1

Published

wrapper for official component, with unofficial component compat

Downloads

70

Readme

react-fontawesome

license npm CircleCI David David dev David peer Greenkeeper badge

Wrapper for official component, with unofficial component compat.

Currently in beta stage.

Since Font-awesome v5 has divided icons into different sets, and renamed many icons, usages with react-fontawesome package could not be updated to official component in a simple find-and-replace way. This package is created to ease the migration, wrapping the official component and automatically shimming v4 icon name.

Installation

yarn add @skagami/react-fontawesome

or

npm install @skagami/react-fontawesome

Note that you should also install @fortawesome/react-svg-core and @fortawesome/react-fontawesome. Due to the API change in FontAwesome 5.1, you should install the version that satisfy the peer dependencies. It seems the official package keeps changing with every pre-release, please report any incompat you meet.

Usage

Replacement

with this package you could simply make a replacement:

- import FA from 'react-fontawesome'
+ import FA from '@skagami/react-fontawesome'

Shim

besides, this package provides a shim method based on official v4-shim.js:

import shim from '@skagami/react-fontawesome/shim'

shim('google-plus') // returns ['fab', 'google-plus-o']

Injection

An inject method for react-fontawesome is available so that you don't even need to do the replacement:

import '@skagami/react-fontawesome/inject'

IMPORTANT: same as official component, you'll need to add the icons yourself.

API

The API is designed to maximize the compat with unofficial react-fontawesome and provide more semantic usage for new v5 icons. Currently only font-awesome@5's svg format icon is supported.

Semantic and compact API

You don't have to combine icon set and icon name in a array to fill in icon prop:

- <Icon icon={['fab', 'google-plus-o']} />
+ <Icon fab icon="google-plus-o" />

fas|far|far|fab and fa(for explicit v4 icon name usage) Boolean prop is supported.

and name prop is also supported:

<Icon fab name="google-plus-o" />

Icon version and name shimming

The icon version is detected by the following procedure:

  • check v5. If truthy, it is a v5 icon
  • check tag, although tag will not take effect. If truthy, it is a v4 icon
  • check if fas, far, fal and fab is all falsy. If any of them is truthy, it is a v5 icon
  • check if icon and name prop is String. If none of them is String, it is a v5 icon (and nothing will show up).
  • check icon. If icon is truthy and it is not String, it is a v5 icon
  • it should be a v4 icon

V4 icon names will be shimmed to v5's

on mask prop, if the icon is believe to be v4, and mask is String, then the mask icon name will also be shimmed