-
Notifications
You must be signed in to change notification settings - Fork 279
feat(ui5-rating-indicator): custom rating icon implemantation #12985
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
base: main
Are you sure you want to change the base?
Conversation
BGSOFUIRILA-4212
restore deleted files
|
🚀 Deployed on https://pr-12985--ui5-webcomponents-preview.netlify.app |
| <br> | ||
|
|
||
| <h3>Custom Icons - Hearts (readonly)</h3> | ||
| <ui5-rating-indicator id="rating-hearts-readonly" value="2.5" icon="heart" unselected-icon="heart-2" readonly></ui5-rating-indicator> |
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 noticed that if we remove unselected-icon here, RatingIndicator still change the icon to heart for unselected (unselected-icon does nothing). This happens only in readonly and disabled.
| * @since 2.20 | ||
| */ | ||
| @property() | ||
| icon?: 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.
I would suggest to use same naming as in the controls - iconSelected, iconUnselected
| * @since 2.20 | ||
| */ | ||
| @property() | ||
| unselectedIcon?: 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.
iconUnselected
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.
| }); | ||
|
|
||
| it("should use custom icon for unselected items when readonly", () => { | ||
| cy.mount(<RatingIndicator value={2} max={5} icon="heart" unselectedIcon="heart-2" readonly></RatingIndicator>); |
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 test is not working for custom unselectedIcon
| }); | ||
|
|
||
| it("should use custom icon for unselected items when disabled", () => { | ||
| cy.mount(<RatingIndicator value={2} max={5} icon="heart" unselectedIcon="heart-2" disabled></RatingIndicator>); |
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.
same
| return ( | ||
| <li class="ui5-rating-indicator-item ui5-rating-indicator-item-unsel"> | ||
| <Icon data-ui5-value={star.index} name={favorite} /> | ||
| <Icon data-ui5-value={star.index} name={this.effectiveIcon} /> |
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 need to use the UNselected icon as the is only for unselected.
| </div> | ||
| </li> | ||
| ); | ||
| } if (this.readonly) { |
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 can add || this.disabled and delete the condition for disabled as they are the same with readonly
| return ( | ||
| <li class="ui5-rating-indicator-item ui5-rating-indicator-item-unsel"> | ||
| <Icon data-ui5-value={star.index} name={favorite} /> | ||
| <Icon data-ui5-value={star.index} name={this.effectiveIcon} /> |
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.
same

BGSOFUIRILA-4212