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

@ebi-gene-expression-group/react-ebi-species

v2.6.2

Published

React component based on the EBI species icons

Downloads

14

Readme

EBI species icons for React

Build Status Coverage Status

A React component to render organisms icons from the EBI-Species font declaratively. Demo of all supported species.

How to use

The component comes in two flavours:

  • Using classes .icon .icon-species declared in fonts.css from the EBI Visual Framework
  • A bare-bones component that you can use in any web application without depending on the EBI VF styles being loaded in your environment

The first one has the advantage that if the global CSS is changed, the component will then pick up the new styles. The second variant doesn’t need any dependency and can be used anywhere and it will just work. Notice that the second version still uses classes, but they will be uniquely scoped to the component

Instructions

To install:

npm install @ebi-gene-expression-group/react-ebi-species --save

To use as a React component:

import EbiSpeciesIcon from '@ebi-gene-expression-group/react-ebi-species'
...
<EbiSpeciesIcon species={`homo sapiens`}/>

Alternatively, to use the “no class” flavour:

import { EbiSpeciesIconBare as EbiSpeciesIcon } from '@ebi-gene-expression-group/react-ebi-species'
...
<EbiSpeciesIcon species={`homo sapiens`}/>

To use as a renderer and attach the icons to DOM elements:

import { render } from '@ebi-gene-expression-group/react-ebi-species'
...
render({ species: 'homo sapiens' }, 'id-of-your-DOM-element')

Or:

import { renderBare as render } from '@ebi-gene-expression-group/react-ebi-species'
...
render({ species: 'homo sapiens' }, 'id-of-your-DOM-element')

To use directly in your browser (see the source of the demo pages):

<script src="dist/vendors.bundle.js"></script>
<script src="dist/ebiSpeciesIcon.bundle.js"></script>
<script src="dist/ebiSpeciesIconBare.bundle.js"></script>

<script>
    ebiSpeciesIcon.render({ species: 'homo sapiens' }, 'id-of-your-DOM-element')
    ebiSpeciesIcon.renderBare({ species: 'homo sapiens' }, 'id-of-your-DOM-element')
</script>

Props

The species prop should be a scientific name, although the names given in the EBI-Species documentation and other variants are available. It is case insensitive. Have a look at the demo page for details.

| Prop | Type | Default value | Use case | |---------------|--------|-----------------------------|--------------------------------------------------| | species | string | 🐰 oryctolagus cuniculus 🐰 | The name of the species to be rendered | | groupColors | object | { warmBlooded: `indianred`, plants: `mediumseagreen`, other: `deepskyblue` } | Colours for groups of organisms | | color | string | | An optional colour that overrides groupColours |

Contribute

Pull requests to enlarge the mapping of species to icons, or with alternative names of species, are very welcome! Extend the mapping as required, then test locally through

npx webpack-dev-server -d

Go to localhost:9000 and see that the new icon appears there.

It is also a good idea to verify that all tests pass:

npx jest

Commit and PR away.

It would be fairly easy to cut the React dependency out of this package if you just need the mapping - if you fork then we can share the species to icon mapping.

Credits

Made in the EBI for Expression Atlas.