Icons package
This package bundles all project-specific SVG icons in a node module.
It uses the svgr
CLI and typescript to turn a source set of SVG icons into a resultant set of React components. The steps are:
- Use
svgr
to convert icons insrc/main/svg
to tsx components insrc/main/generated
. - Run a typescript build to convert the
generated
components into ES2020 modules in thedist
folder.
Contribution
To add a new icon that isn’t available as a Carbon Icon or Carbon Pictogram:
- Download the latest Sketch file from Box.
- Add attribution where required so we can do manual open-source audits for all icons that didn’t come from Carbon icon and pictogram code packages.
- Size the SVG at its intended size so we can be pixel-precise for standard density displays (SVGs can get resized in the web app so this isn’t overly important.)
- Include an internal 2px padding for 32px icons per IBM Design Language specifications (1px padding for 16px icons.)
- Ensure the fill colors are all black.
- Use a slice to export the SVG (so we can preserve internal padding.)
- Place the SVG in the path specified above.
- Run a build prior to using the optimized SVGs as React components in the web app.
- Upload the new version of the Sketch file to Box.