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

@apollo/icons

v0.3.3

Published

This package contains a vast collection of SVG icons for use in websites that we develop. The icons are published as directories of SVG files, named according to the [Icons page](https://www.figma.com/file/oOOoo7e9gPEoDSX4xJmMUk/Orbit-Design-System?type=d

Downloads

3,649

Readme

@apollo/icons

This package contains a vast collection of SVG icons for use in websites that we develop. The icons are published as directories of SVG files, named according to the Icons page in our design system Figma file.

Installation

yarn add @apollo/icons

Usage

The icons are available as three different variants: default, small, and large. Your import path should take the following format:

import IconName from "@apollo/icons/{variant}/{IconName}.svg";

This package also publishes our logo, two ways. :cook: The LogoSymbol is just the Apollo "A" with an orbit around it, and the LogoType includes the name "Apollo". Import either one from the logos directory, like this:

import LogoType from "@apollo/icons/logos/LogoType.svg";
import LogoSymbol from "@apollo/icons/logos/LogoSymbol.svg";

Using the icons

The icons can be consumed in a number of ways, mostly depending on your project's build system. Below are a couple of the common ways the icons can be consumed, but if you prefer to handle icons differently, you do you!

Import as a URL

Projects built with webpack (or Next.js, Gatsby, etc.) can be configured to import image files as a URL. The image URL can then be inserted into an HTML img tag as its src property. If you're using React, it might look like this:

import iconAdd from "@apollo/icons/default/IconAdd.svg";

export const MyComponent = () => {
  return <img src={iconAdd} />;
}

Import as a React component

By using a tool like SVGR, you can convert SVG files to React components on the fly. After you configure SVGR, you can import and render the icons like this:

import IconAdd from "@apollo/icons/default/IconAdd.svg";

export const MyComponent = () => {
  return <IconAdd />;
}

The React component method is almost always preferred, since it gives you control over the color of the icon. But SVGR is very configurable! You can even configure it to combine both strategies, so you can decide whether you want to import an image URL or React component (or both).

import IconAddURL, {
  ReactComponent as IconAdd
} from "@apollo/icons/default/IconAdd.svg";

export const MyComponent = () => {
  return (
    <>
      {/* why would you ever do this? 🤷 */}
      <img src={iconAdd} />
      <IconAdd />
    </>
  );
}

Icon color

When used as React components, all icons are configured to inherit the text color of their parent element. The icon color can be changed by applying a custom color style.

import IconAdd from "@apollo/icons/default/IconAdd.svg";

export const MyComponent = () => {
  return (
    <div style={{ color: "blue" }}>
      <IconAdd />
      <IconAdd style={{ color: "red" }} />
    </div>
  );
}

Contributing

If we need to add a new icon to this package, the flow will typically look like this:

  1. Locate the new icon(s) in the Figma file.
  2. Export the default, small, and large variants of that icon.
  3. Move those files to the appropriate directory within the src directory of this project.
  4. If necessary, rename the exported files to match the name in Figma, i.e., IconAlert.svg.
  5. Create a PR that includes the icon additions, and don't forget to create a changeset!
  6. Follow the remaining steps in the publishing guide, and your icon(s) will be published. :rocket: