Skip to content

Commit

Permalink
#931: create alert dialog component (dialog with only a close button)
Browse files Browse the repository at this point in the history
  • Loading branch information
clean-coder committed Jul 29, 2024
1 parent 3e49de2 commit 30c378b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<section mat-dialog-title>
<app-dialog-header [dialogTitle]="this.data.dialogTitle"></app-dialog-header>
</section>

<mat-dialog-content>
@if (data.dialogText) {
<div class="mb-3">
<span class="dialog-text">{{ this.data.dialogText }}</span>
</div>
}
</mat-dialog-content>

<mat-dialog-actions class="m-0">
<button color="primary" [attr.data-testId]="'alertDialog-confirm'" (click)="closeDialog()" mat-flat-button>
Schliessen
</button>
</mat-dialog-actions>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

export type AlertDialogData = {
dialogTitle: string;
dialogText?: string;
};

@Component({
selector: 'app-alert-dialog',
templateUrl: './alert-dialog.component.html',
styleUrl: './alert-dialog.component.scss',
})
export class AlertDialogComponent {
constructor(
@Inject(MAT_DIALOG_DATA) public data: AlertDialogData,
private dialogRef: MatDialogRef<AlertDialogComponent>,
) {}

closeDialog() {
this.dialogRef.close();
}
}
2 changes: 2 additions & 0 deletions frontend/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { RouterOutlet } from '@angular/router';
import { SpinnerComponent } from './custom/spinner/spinner.component';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { CancelDialogComponent } from './dialog/cancel-dialog/cancel-dialog.component';
import { AlertDialogComponent } from './dialog/alert-dialog/alert-dialog.component';

@NgModule({
declarations: [
Expand All @@ -42,6 +43,7 @@ import { CancelDialogComponent } from './dialog/cancel-dialog/cancel-dialog.comp
SidepanelComponent,
SpinnerComponent,
CancelDialogComponent,
AlertDialogComponent,
],
imports: [
CommonModule,
Expand Down

0 comments on commit 30c378b

Please sign in to comment.