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

fa-shorthand.macro

v0.2.0

Published

shorthand for react-fontawesome

Downloads

523

Readme

fa-shorthand.macro

Npm Babel Macro

A babel-plugin-macros that provide a shorthand access to Font Awesome using react-fontawesome

TOC

Get Started

This package is for integrating Font Awesome 5 React component using SVG.

Peer Dependency

Ensure you have babel-plugin-macros installed within your project. And the react-fontawesome installed with the icons packages you are using.

$ npm i --save @fortawesome/free-brands-svg-icons
$ npm i --save @fortawesome/free-regular-svg-icons

If you are a Font Awesome Pro subscriber you can install Pro packages.

$ npm i --save @fortawesome/pro-solid-svg-icons
$ npm i --save @fortawesome/pro-regular-svg-icons
$ npm i --save @fortawesome/pro-light-svg-icons
$ npm i --save @fortawesome/pro-duotone-svg-icons

Usage

You can use Font Awesome icons in your React components as simply as this:

import { Icon } from 'fa-shorthand.macro'


<Icon icon={Icon.regularFree.check} size="xs"/>
<Icon icon={Icon.brands.buyNLarge}/>
<Icon icon={Icon.doutone.coffee} size="6x"/>

Features

Layers

import { Icon, IconsLayers } from 'fa-shorthand.macro'

<IconsLayers>
  <Icon icon={Icon.regularFree.square} color="green" />
  <Icon icon={Icon.regularFree.check} inverse transform="shrink-6" />
</IconsLayers>

Stack

A size prop is needed for IconsStack and Icon children. [default 1x]

Icon child with no size prop will inherit the IconsStack size or default to 1x

import { Icon, IconsStack } from 'fa-shorthand.macro';

<IconsStack size="2x">
  <Icon size="1x" icon={Icon.regularFree.square} color="green" />
  <Icon size="2x" icon={Icon.regularFree.check} inverse transform="shrink-6" />
</IconsStack>

<IconsStack />

| prop | type | default | |:----:|:----:|:-------:| |size|string/number| 1x|

Under The Hood

Basic

<Icon icon={Icon.regularFree.coffee}/>

the code block above will generate the following results

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' // <Icon />
import { faCoffee as farCoffee } from '@fortawesome/free-regular-svg-icons' // Icon.regularFree.coffee

<FontAwesomeIcon icon={farCoffee} />

Layers

<IconsLayers>
  <FontAwesomeIcon icon={Icon.regularFree.square} color="green" />
  <FontAwesomeIcon icon={Icon.regularFree.check} inverse transform="shrink-6" />
</IconsLayers>

the code block above will generate the following results

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCoffee as farCheck, faSquare as farSquare } from '@fortawesome/free-regular-svg-icons'


<span className="fa-layers fa-fw">
  <FontAwesomeIcon icon={farSquare} color="green" />
  <FontAwesomeIcon icon={farCheck} inverse transform="shrink-6" />
</span>

Stack

<IconsStack>
  <FontAwesomeIcon icon={Icon.regularFree.square} color="green" />
  <FontAwesomeIcon icon={Icon.regularFree.check} inverse transform="shrink-6" />
</IconsStack>

the code block above will generate the following results

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCoffee as farCheck, faSquare as farSquare } from '@fortawesome/free-regular-svg-icons'


<span className="fa-stack fa-stack-1x">
  <FontAwesomeIcon className="fa-stack-1x" icon={farSquare} color="green" />
  <FontAwesomeIcon className="fa-stack-1x" icon={farCheck} inverse transform="shrink-6" />
</span>

Support

Bug/Suggestions open an issue on Gitlab or by email