Skip to content
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

fix(ui5-rating-indicator): Apply correct color for readonly unselec… #3992

Merged
merged 2 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/main/src/RatingIndicator.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<div class="ui5-rating-indicator-icon ui5-rating-indicator-active-icon" data-value="{{this.index}}">&#9733;</div>
{{else if this.halfStar}}
<div class="ui5-rating-indicator-icon ui5-rating-indicator-half-icon" data-value="{{this.index}}">&#9734;</div>
{{else if this.readonly}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See for example this snippet on how to use a global value:

{{#each items}}
			{{#if this.selected}}
				<ui5-token
					?readonly="{{../readonly}}"
					class="ui5-multi-combobox-token"
					data-ui5-id="{{this._id}}"
					part="token-{{@index}}"
					text="{{this.text}}"
				>
				</ui5-token>
			{{/if}}
		{{/each}}
		```

<div class="ui5-rating-indicator-icon ui5-rating-indicator-readonly-unselected-icon" data-value="{{this.index}}">&#9733;</div>
{{else}}
<div class="ui5-rating-indicator-icon" data-value="{{this.index}}">&#9734;</div>
{{/if}}
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/RatingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class RatingIndicator extends UI5Element {
selected: i <= tempValue,
index: i,
halfStar,
readonly: this.readonly,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have the same value for all items. You don't need to push it here in order to access it in the .hbs file. Use the ../ syntax

});
}
}
Expand Down
14 changes: 9 additions & 5 deletions packages/main/src/themes/RatingIndicator.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
cursor: initial;
}

:host([readonly]) .ui5-rating-indicator-icon.ui5-rating-indicator-readonly-unselected-icon {
color: var(--sapContent_UnratedColor);
}

:host([_focused]) {
outline: 1px dotted var(--sapContent_FocusColor);
}
Expand All @@ -34,11 +38,11 @@

.ui5-rating-indicator-icon.ui5-rating-indicator-half-icon:before {
content: "\2605";
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 100%;
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 100%;
color: var(--sapContent_RatedColor);
overflow: hidden;
}
Expand Down