-
Notifications
You must be signed in to change notification settings - Fork 16
feat(#280): adds icon component with material desing icons #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4ce9de5
Adds material icons library and icon component
latin-panda a471971
Merge branch 'main' of https://github.com/getodk/web-forms into mater…
latin-panda 6769b72
Replace with new icon component
latin-panda 668538c
Replace with new icon component image upload and rank
latin-panda d01c26b
Removed icomoon
latin-panda a32be7f
lint
latin-panda 93b710b
changeset
latin-panda ed24522
Typos
latin-panda 2d5a9e9
Feedback
latin-panda 14bb968
Icon sizes to 20px
latin-panda 6437e99
Icons for group and repeat
latin-panda 83df5cd
Fixes lint
latin-panda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@getodk/web-forms': patch | ||
--- | ||
|
||
Adds icon component with Material Design icons to replace Icomoon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,18 +106,16 @@ This package uses the Material Design system for the UI, though not strictly. Th | |
|
||
### Icons | ||
|
||
We use **Material Icons** using IcoMoon to select a subset of icons in order to minimize the size. The font files are located in [`./src/assets/fonts/`](./src/assets/fonts/), and the CSS is [`./src/assets/css/icomoon.css`](/src/assets/css/icomoon.css). Our IcoMoon definition is in the root directory of this package at [`./icomoon.json`](./icomoon.json). | ||
The `Icon` component renders Material Design Icons (MDI) with customizable size and style variants. It uses the `@mdi/js` library for icon data and supports a predefined set of icons. | ||
|
||
To update the icons using the [IcoMoon website](https://icomoon.io/app/): | ||
```js | ||
<IconSVG name="mdiCamera" size="md" variant="primary" /> | ||
``` | ||
|
||
1. Click the "Import Icons" button in IcoMoon. Select [`icomoon.json`](/icomoon.json). When prompted, load the settings stored in the file. | ||
2. Scroll down to the "Add Icons From Library" link and add **Material Icons**. | ||
3. Move the imported set above Material Icons, using the 3-bar icon to the right of the imported set's title. (This should help preserve the icon order and minimize the diff.) | ||
4. Update the icons by selecting (highlighting) the new icons to add. They don't need to be moved or altered. | ||
5. Download the new font, then copy the files (`icomoon.css`, `fonts/*`, `icomoon.json`) into their locations in the repository. | ||
- You will need to rename the files and update the paths in the CSS (`fonts/icomoon.ttf?...` becomes `/fonts/icomoon.ttf?...` with a beginning slash). | ||
- You will also need to prettify the JSON file to use two space indentation. | ||
To add a new icon: | ||
|
||
By following the steps above, you should minimize the diff. However, in the JSON file, you may still see changes for properties like `id`, `iconIdx`, `setId`, and `setIdx`. | ||
- Import the icon from `@mdi/js` in the `Icon` component. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
- Add the icon to the `iconMap` object with its corresponding name. | ||
- Use the icon by passing its name to the `name` prop. | ||
|
||
Material Icons are available under the Apache License Version 2.0. Copy of the license can be found at [`./src/assets/fonts/LICENSE-2.0.txt`](./src/assets/fonts/LICENSE-2.0.txt) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.