Skip to content

Commit

Permalink
chore(intenral-docs): add icons doc
Browse files Browse the repository at this point in the history
  • Loading branch information
krisantrobus committed Jan 21, 2025
1 parent 2e22b6a commit ed43f05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal-docs/engineering/icons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Icons

- [Icons](#icons)
- [Adding Icons](#adding-icons)
- [Generating Icons](#generating-icons)

Our icons are converted from SVG to React components at compile time using our own “svg-to-react” library: [https://github.com/twilio-labs/svg-to-react](https://github.com/twilio-labs/svg-to-react)

## Adding Icons

The process for adding icons is very simple thanks to our naming conventions and conversion library.

Any new SVG assets must be copied into the [svg](../../packages/paste-icons/svg/) folder. We often see the `viewBox` attribute missing so be sure the top level element has the following:

```html
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
```

## Generating Icons

To generate newly added icons you can use the command `yarn convert:icons:new` from the root of the repo. This will create the new React components and appends the "Icon" string to the component name.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"generate:embeddings:refresh": "yarn nx run @twilio-paste/website:generate:embeddings:refresh",
"generate:db-types": "yarn nx run @twilio-paste/backend:generate:db-types",
"generate:website-data": "yarn workspace @twilio-paste/website fetch:data",
"convert:icons:new": "yarn workspace @twilio-paste/icons convert-new",
"pre-push": "concurrently \"yarn:lint\" \"yarn:test\" \"yarn:format\" \"yarn:type-check\"",
"prerelease": "yarn build && yarn generate:website-data && yarn lint && yarn test",
"release": "yarn changeset publish",
Expand Down

0 comments on commit ed43f05

Please sign in to comment.