Skip to content

Commit

Permalink
refactor: control flow
Browse files Browse the repository at this point in the history
wghglory committed Sep 27, 2024
1 parent 1f170d5 commit 2cf9423
Showing 2 changed files with 51 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
<span [ngSwitch]="iconStatus()" class="status-container">
<cds-icon
*ngSwitchCase="'success'"
shape="success-standard"
status="success"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.success' | translate"
/>
<cds-icon
*ngSwitchCase="'error'"
shape="error-standard"
status="danger"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.error' | translate"
/>
<cds-icon
*ngSwitchCase="'pending'"
shape="sync"
status="info"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.pending' | translate"
/>
<cds-icon
*ngSwitchCase="'warning'"
shape="warning-standard"
status="warning"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.warning' | translate"
/>
<cds-icon
*ngSwitchCase="'inactive'"
shape="disconnect"
status="danger"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.inactive' | translate"
/>
<cds-icon
*ngSwitchDefault
shape="unknown-status"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.unknown' | translate"
/>
<span class="status-container">
@switch (iconStatus()) {
@case ('success') {
<cds-icon
shape="success-standard"
status="success"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.success' | translate"
/>
}
@case ('error') {
<cds-icon
shape="error-standard"
status="danger"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.error' | translate"
/>
}
@case ('pending') {
<cds-icon
shape="sync"
status="info"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.pending' | translate"
/>
}
@case ('warning') {
<cds-icon
shape="warning-standard"
status="warning"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.warning' | translate"
/>
}
@case ('inactive') {
<cds-icon
shape="disconnect"
status="danger"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.inactive' | translate"
/>
}
@default {
<cds-icon
shape="unknown-status"
[attr.size]="iconSize()"
[attr.aria-label]="'status-indicator.unknown' | translate"
/>
}
}

<ng-content></ng-content>
</span>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CommonModule} from '@angular/common';
import {HttpErrorResponse} from '@angular/common/http';
import {
AfterViewInit,
@@ -27,7 +26,7 @@ import {TimelineWizardService} from './timeline-wizard.service';
@Component({
selector: 'cll-timeline-wizard',
standalone: true,
imports: [CommonModule, ClarityModule, TranslatePipe],
imports: [ClarityModule, TranslatePipe],
providers: [TimelineWizardService],
templateUrl: './timeline-wizard.component.html',
styleUrls: ['./timeline-wizard.component.scss'],

0 comments on commit 2cf9423

Please sign in to comment.