
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
react-ebi-species
Advanced tools
A React component to render organisms icons from the EBI-Species font declaratively. Demo of all supported species.
The component comes in two flavours:
.icon .icon-species
declared in fonts.css
from the EBI Visual FrameworkThe 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
To install:
npm install --save react-ebi-species
To use as a React component:
import EbiSpeciesIcon from 'react-ebi-species'
...
<EbiSpeciesIcon species={`homo sapiens`}/>
Alternatively, to use the “no class” flavour:
import { EbiSpeciesIconBare as EbiSpeciesIcon } from 'react-ebi-species'
...
<EbiSpeciesIcon species={`homo sapiens`}/>
To use as a renderer and attach the icons to DOM elements:
import { render } from 'react-ebi-species'
...
render({ species: 'homo sapiens' }, 'id-of-your-DOM-element')
Or:
import { renderBare as render } from '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>
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 |
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 --mode=development
Go to localhost:9000
and see that the new icon appears there.
It is also a good idea to verify that all tests pass:
npm run testOnly
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.
Made in the EBI for Expression Atlas.
FAQs
React component based on the EBI species icons
The npm package react-ebi-species receives a total of 66 weekly downloads. As such, react-ebi-species popularity was classified as not popular.
We found that react-ebi-species demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.