Add support for uploading and assigning custom SVG icons to libraries… (#1788)
* Add support for uploading and assigning custom SVG icons to libraries and shelves * Add few default icons
This commit is contained in:
@@ -3,11 +3,16 @@ import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {IconPickerComponent} from '../components/icon-picker/icon-picker-component';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
export interface IconSelection {
|
||||
type: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
value: string;
|
||||
}
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class IconPickerService {
|
||||
private dialog = inject(DialogService);
|
||||
|
||||
open(): Observable<string> {
|
||||
open(): Observable<IconSelection> {
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const ref: DynamicDialogRef | null = this.dialog.open(IconPickerComponent, {
|
||||
header: 'Choose an Icon',
|
||||
@@ -22,6 +27,6 @@ export class IconPickerService {
|
||||
minWidth: isMobile ? '90vw' : '800px',
|
||||
}
|
||||
});
|
||||
return ref!.onClose as Observable<string>;
|
||||
return ref!.onClose as Observable<IconSelection>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,9 @@ export class UrlHelperService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getIconUrl(iconName: string): string {
|
||||
const url = `${this.mediaBaseUrl}/icon/${iconName}`;
|
||||
return this.appendToken(url);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user