Skip to content

Commit

Permalink
feat: add css variables for rating-max, rating-value & rating-frac
Browse files Browse the repository at this point in the history
Closes fvilers#5
  • Loading branch information
GerkinDev committed Jun 16, 2021
1 parent 7ad902f commit 6a45716
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ng-container *ngxRange="let index from 0 to max">
<button mat-icon-button [class.dense]="dense" [class.readonly]="readonly" [color]=" color" [disabled]="disabled"
[style.--rating-value]="index + 1" [style.--rating-frac]="(index + 1) / max"
[disableRipple]="readonly" (click)="onClick(index)">
<mat-icon>{{getStar(index)}}</mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Component,
EventEmitter,
forwardRef,
HostBinding,
Input,
Output,
} from '@angular/core';
Expand Down Expand Up @@ -38,6 +39,7 @@ export class NgxMaterialRatingComponent implements ControlValueAccessor {
color: ThemePalette = undefined;

@Input()
@HostBinding( 'style.--rating-max' )
get max(): number {
return this._max;
}
Expand Down

0 comments on commit 6a45716

Please sign in to comment.