This package contains optimized SVG icons to be used on Funda
npm install @funda/icons
import { ThumbsDown } from "@funda/icons/lib/esm";
import Alert from "@funda/icons/lib/esm/alert";
const { ThumbsDown } = require("@funda/icons/lib/cjs");
const Alert = require("@funda/icons/lib/cjs/alert");
Both ESM and CJS format will return:
{
title: 'thumbs-down',
svg: '<svg role="img" viewBox="0 0 24 24" ...'
}
import { ThumbsDown } from "@funda/icons/lib/vue";
import Alert from "@funda/icons/lib/vue/alert";
export default {
...,
components: { ThumbsDown }
...,
}
You might not want to use the icons directly into your JS application. In that case the raw SVG icons are also available on the package, you just need to copy to you project.
cp node_modules/@funda/icons/assets/* src/SPECIFY_YOUR_PATH
- Create a new branch
- Add the svg of the new icon in the assets folder
- Commit your changes, following the rules of commitlint
npm run build
- Create a pull request against the master branch
This repo uses commitlint, which means that it follows specific commit message rules, If the messages are not on the expected format it wont be possible to commit/push your changes. These commits will automatically release new versions to NPM based on the rules of semantic-release.
Examples of commit messages
feat(branch_name): commit message
fix(branch_name): commit message
PS: It is recommended to use the terminal for commit, if you use any GUI it might be necessary to update you local variable PATH on your GUI. Reference: Husky issues
Most of our icons are designed in Illustrator. For these instructions I take the file with all icons as the reference. You can find this file in the shared UX folder. Designing and exporting icons using Illustrator is preferred, since this will result in the properly aligned icons and optimized exports.
- Hide all unnecessary layers, like the Grid
- Go to File > Export > Export for Screens...
- Select 'SVG' as format and set a export location to your likings
- Give the icon a proper name in the left panel
- Click Export Artboard. The folder with the exported SVG appears automatically
If a icon is originally designed in Sketch, you'll need to do some manual steps for a proper export. This is because exporting in Sketch works in a different way.
- Select the artboard of the icon you want to export, hide all unnecessary if needed.
- Make sure 'SVG' is selected as a preset in the right panel
- Export the icon with Export Selected... and select the location where you want to store te file
- After exporting, open de SVG file using your favorite code editor
- Remove the width and height properties from the
<svg />
tag, but leave the viewbox property untouched
We have a pre-commit hook that will optimize the svg icons using svgo
- All default configuration from svgo are applied, including make everything inline;
role="img"
is added;- Dimensions, i.e:
width
andheight
are removed