Skip to content

Commit

Permalink
refactor: modal dialog improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Dec 9, 2024
1 parent d7174c2 commit 77ea3d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ <h3>{{ 'account.organization.org_settings.preferences.subtitle' | translate }}</
confirmText: 'account.update.button.label' | translate,
rejectText: 'account.cancel.button.label' | translate,
titleText: 'account.organization.budget_price_type.notification_modal.header' | translate,
faIconClass: 'text-warning pr-2',
faIcon: ['fas', 'triangle-exclamation']
icon: ['fas', 'triangle-exclamation'],
iconClass: 'text-warning pr-2'
}"
(confirmed)="submit()"
(closed)="resetValue()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<ng-template #template>
<div class="modal-header">
<h2 *ngIf="options?.titleText" class="modal-title">
<fa-icon *ngIf="options?.faIcon" class="{{ options.faIconClass }}" [icon]="options.faIcon" />{{
options.titleText
}}
<h2 *ngIf="options.titleText" class="modal-title">
<fa-icon *ngIf="options.icon" [icon]="options.icon" class="{{ options.iconClass }} " />{{ options.titleText }}
</h2>
<button type="button" class="close" [title]="'dialog.close.text' | translate" (click)="hide()">
<span aria-hidden="true">&times;</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ export interface ModalOptions extends NgbModalOptions {
*/
rejectText?: string;
/**
* Optional fa icon styling classes.
* Optional icon properties to display an icon in front of the title, e.g. ['fas', 'triangle-exclamation'],
*/
faIconClass?: string;
icon?: IconProp;
/**
* Optional icon parameters.
* Optional icon styling classes, e.g. faIconClass: 'text-warning pr-2'
*/
faIcon?: IconProp;
iconClass?: string;
}

/**
Expand All @@ -63,7 +63,7 @@ export interface ModalOptions extends NgbModalOptions {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ModalDialogComponent<T> implements OnDestroy {
@Input() options: ModalOptions;
@Input({ required: true }) options: ModalOptions;

@Output() confirmed = new EventEmitter<T>();

Expand Down

0 comments on commit 77ea3d4

Please sign in to comment.