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: 🚑 storybook render message alert #755 #756

Closed
Closed
8 changes: 5 additions & 3 deletions projects/ion/src/lib/alert/alert.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
class="alert-icon"
[type]="iconType"
></ion-icon>
<span *ngIf="hasPlainText; else customBody" data-testid="ion-alert-message">{{
message
}}</span>
<span
*ngIf="message && !message._def; else customBody"
data-testid="ion-alert-message"
>{{ message }}</span
>

<ng-template #customBody>
<ng-container [ngTemplateOutlet]="message"></ng-container>
Expand Down
6 changes: 1 addition & 5 deletions projects/ion/src/lib/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Input,
OnChanges,
OnInit,
SimpleChanges,
TemplateRef,
ViewChild,
} from '@angular/core';
Expand Down Expand Up @@ -49,10 +48,7 @@ export class IonAlertComponent implements OnInit, OnChanges {
}
}

ngOnChanges(changes: SimpleChanges): void {
ngOnChanges(): void {
this.setIcon();
if (changes.message) {
this.hasPlainText = typeof this.message === 'string';
}
}
}