The icon set for Fabric, imported from the Figma project.
Note that the icons in the "raw" folder in this repository should never be used directly, as they aren't optimized.
You will need to install both Fabric Elements and Lit Element which is the library we use for custom elements
npm install lit @fabric-ds/icons
Import the individual element file, importing will load the component. Once imported, run your script through whatever bundling process your app uses (Rollup, Esbuild, etc) after which the component can be used in the page.
import '@fabric-ds/icons/elements/attachment-16';
import '@fabric-ds/icons/elements/attachment-24';
<f-icon-attachment16></f-icon-attachment16>
<f-icon-attachment24></f-icon-attachment24>
Icons should never be added or edited manually in this repository, as the source of truth is in Figma.
If you are running the import script for the first time, it will prompt your for a Figma access token. The token is is required to access Figma's API. It can be generated on your Figma account settings page.
The import script may store the token to a local file, so you won't have to supply the token again on subsequent runs.
To update the icons, run the following script. If it has a valid Figma access token (see above), it will proceed to download all the icons as SVG files.
./scripts/figma-import.js
You can open a local preview of the icons. Use this to verify that the icons looks as they should. Run the following command.
npm run start
If everything looks correct, publish the changes.
npm publish
git push --follow-tags
Eik versions for each of Vue, Elements and React icons are automatically created in the ./dist folder when builds are run. Eik configuration is based on values in package.json (name, version and eik keys) and running Eik publish will publish everything in the dist folder to Eik under the path https://assets.finn.no/pkg/{name}/{version}/
.
Example Paths:
- React:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/react/icons.min.js
- Vue:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/vue/icons.min.js
- Custom Elements:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/elements/icons.min.js
- Raw ads svg at size 16:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/16/ads.svg
- Raw air con svg at size 24:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/24/air-con.svg
If the scripts authentication issues, you could try to create a new access token and delete the local file .FIGMA_TOKEN
before running the script again.
The script is probably not resilient to changes in the structure of the Figma project. Changes there will probably require an update of the import script.