Skip to content

Commit

Permalink
new accessStatusClass atribute
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-graca authored Nov 10, 2023
1 parent 3bf2eb1 commit 6378dbe
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { ITEM } from '../../../../../core/shared/item.resource-type';

@Component({
selector: 'ds-access-status-badge',
templateUrl: './access-status-badge.component.html'
templateUrl: './access-status-badge.component.html',
styleUrls: ['./access-status-badge.component.scss']
})
/**
* Component rendering the access status of an item as a badge
Expand All @@ -26,6 +27,11 @@ export class AccessStatusBadgeComponent {
*/
showAccessStatus: boolean;

/**
* Value based stylesheet class for access status badge
*/
accessStatusClass: string;

/**
* Initialize instance variables
*
Expand Down Expand Up @@ -57,5 +63,12 @@ export class AccessStatusBadgeComponent {
map((status: string) => `access-status.${status.toLowerCase()}.listelement.badge`),
catchError(() => observableOf('access-status.unknown.listelement.badge'))
);

// stylesheet based on the access status value
this.accessStatus$.pipe(
map((accessStatusClass: string) => accessStatusClass.replace(/\./g, '-'))
).subscribe((accessStatusClass: string) => {
this.accessStatusClass = accessStatusClass;
});
}
}

0 comments on commit 6378dbe

Please sign in to comment.