-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
🦋 Changeset detectedLatest commit: 83df5cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -25,8 +25,11 @@ | |||
--odk-primary-lighter-background-color: var(--p-primary-50); | |||
--odk-primary-border-color: var(--p-primary-500); | |||
|
|||
--odk-error-text-color: var(--p-message-error-color); | |||
--odk-error-background-color: var(--p-message-error-background); | |||
--odk-error-text-color: var(--p-red-600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that --p-message-error-background
is not always available if the message component is unused. Better use the base color variable from PrimeVue
@@ -38,8 +41,6 @@ | |||
|
|||
--odk-border-color: var(--p-surface-300); | |||
|
|||
--odk-icon-size: 1.5rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unlikely to be customized in theming. The primary reason for removing it and letting the IconSVG component handle it is that the SVG's path, which contains the image, is resized using CSS transform.
</Button> | ||
<Menu id="overlay_menu" ref="menu" :model="items" :popup="true"> | ||
<template #item="{ item }"> | ||
<a class="p-menu-item-link" v-if="item.command != null" @click="(event) => item.command?.({ originalEvent: event, item })"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript static check doesn't understand that the item.command
is already validated in the v-if="item.command != null"
🤦🏽♀️ That's why the optional chaining operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like vuejs/vetur#1212?
Maybe !
instead of ?
is slightly more explicit since you know it isn't null at that point but not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a lint warning here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, the !
didn't fix the TypeScript static check and requires a bit more to make it work. Ultimately, I'm checking item.command
is defined before calling it.
I've fixed the GH's lint warning.
@@ -75,18 +76,7 @@ watchEffect(() => { | |||
:disabled="isDisabled" | |||
@click="triggerInputField(takePictureInput)" | |||
> | |||
<svg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Red is the new black 😌
content: '\2713'; | ||
font-family: system-ui; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems close enough to the check mark from Material Icon. It wasn't worth the effort to customize this component to use Material Icons (for now).
It's a safe well supported font, I tested this font in chrome, firefox, safari
} from '@mdi/js'; | ||
|
||
// Find icons here: https://pictogrammers.com/library/mdi/ | ||
const iconMap: Record<string, string> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have that many icons. If it grows a lot eventually, we will extract it to a file; for now, it's good to have it in one place.
@lognaturel @alyblenkin I need to do another pass of testing, but you can start reviewing. Please find the screenshots in this section from the PR's description: ![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small questions in line!
packages/web-forms/README.md
Outdated
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
IconSVG
?
</Button> | ||
<Menu id="overlay_menu" ref="menu" :model="items" :popup="true"> | ||
<template #item="{ item }"> | ||
<a class="p-menu-item-link" v-if="item.command != null" @click="(event) => item.command?.({ originalEvent: event, item })"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a lint warning here.
Looking good! The comments below are small and not a deal breaker.
|
@alyblenkin @lognaturel I’ve addressed the feedback:
|
Closes #280
I have verified this PR works in these browsers (latest versions):
What else has been done to verify that this works as intended?
I verified the bundle, and I confirm that the tree-shaking is working:
Test evidence:
Web Form Preview Page
Rank
Multiselect (check icon)
Image upload
Geopoint
Form header
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
User won't notice significant changes
Do we need any specific form for testing your changes? If so, please attach one.
No
What's changed
@mdi/js
IconSVG