fix: Consistent dialogs (#1842)
* fix/consistent-dialogs * fix: enforce consistent mobile dialog width * fix: cover search dialog image size
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {IconPickerComponent} from '../components/icon-picker/icon-picker-component';
|
||||
import {Observable} from 'rxjs';
|
||||
import {DialogLauncherService} from '../services/dialog-launcher.service';
|
||||
|
||||
export interface IconSelection {
|
||||
type: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
@@ -10,23 +9,10 @@ export interface IconSelection {
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class IconPickerService {
|
||||
private dialog = inject(DialogService);
|
||||
private dialogLauncherService = inject(DialogLauncherService);
|
||||
|
||||
open(): Observable<IconSelection> {
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const ref: DynamicDialogRef | null = this.dialog.open(IconPickerComponent, {
|
||||
header: 'Choose an Icon',
|
||||
modal: true,
|
||||
closable: true,
|
||||
style: {
|
||||
position: 'absolute',
|
||||
top: '10%',
|
||||
bottom: '10%',
|
||||
width: isMobile ? '90vw' : '800px',
|
||||
maxWidth: isMobile ? '90vw' : '800px',
|
||||
minWidth: isMobile ? '90vw' : '800px',
|
||||
}
|
||||
});
|
||||
const ref = this.dialogLauncherService.openIconPickerDialog();
|
||||
return ref!.onClose as Observable<IconSelection>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user