Skip to content

peri-verse-react-icons 1.0.0

Install from the command line:
Learn more about npm packages
$ npm install @nandosuk/peri-verse-react-icons@1.0.0
Install via package.json:
"@nandosuk/peri-verse-react-icons": "1.0.0"

About this version

PERi-Verse React Icons

This package is responsible for the React implementation of PERi-Verse Icons. The main function of this package is:

  • Copying SVG files from the third party package @material-symbols to the svg folder
  • Generating React components from each copied SVG file
  • Exporting all the components

Supported icons

All supported icons are listed as an array in the supported-icons.js file. These icons are sourced from the Material Symbols Library, with the following specs:

  • Fill: 0 (1 if needed)
  • Weight: 400
  • Grade: 0
  • Size: 48px

How to generate a new icon

  • Visit the Material Symbols Library
  • Copy the name of the icon you want to add (e.g., ad_group)
  • Add the icon name to the supported-icons.js array
  • Run yarn build in your terminal
    • This will copy the SVG file of the new icon to the svg directory and generate a new React component for it
  • Commit and push the changes in a new PR
  • Once merged, the new icon will be available to be imported as component

How do I use my new icon as a React Component?

Enable the newly generated icon in the Icon component of the react-components package, specifically in the icons mapper:

  • Open the iconMapper.ts file inside the Icon component
  • Import the icon component from this package
  • Add a new entry to the mapper object
    • The key matching the icon name from the Material Symbols Library
    • The value being the name of the generated icon component
    • Refer to the dist folder if unsure about the component's name

Example of mapping a new icon:

// packages/react-components/src/lib/components/Icon/iconMapper.ts

{
  AdGroup,
  // ...
} from '@nandosuk/peri-verse-react-icons';

const iconMapper = {
  // ...
  ad_group: AdGroup,
}

export { iconMapper };

After adding the entry to the icons mapper, the new icon can be used with the Icon component:

import { Icon } from '@nandosuk/peri-verse-react-components';

<Icon name="ad_group" />;

Scripts

Command Description
yarn build Converts SVG files into React components by running yarn copy and yarn svg-react
yarn copy Copies all supported SVG icon files from @material-symbols/svg-400 into the local src/svg directory
yarn svg-react Generates React components from all local files created by the copy script
yarn commit Correctly formats a commit message via prompts
yarn test Runs unit tests using jest

Details


Assets

  • peri-verse-react-icons-1.0.0.tgz

Download activity

  • Total downloads 1
  • Last 30 days 0
  • Last week 0
  • Today 0