mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-14030] Fix header custom color (#8595)
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ObjectUtils } from '../common/utils/object-utils';
|
||||
import { Observable, ReplaySubject } from 'rxjs';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { map, distinctUntilChanged, take } from 'rxjs/operators';
|
||||
import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions';
|
||||
import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface';
|
||||
@@ -70,11 +70,11 @@ export class AppConfigService {
|
||||
};
|
||||
|
||||
status: Status = Status.INIT;
|
||||
protected onLoadSubject: ReplaySubject<any>;
|
||||
protected onLoadSubject: Subject<any>;
|
||||
onLoad: Observable<any>;
|
||||
|
||||
constructor(protected http: HttpClient, protected extensionService: ExtensionService) {
|
||||
this.onLoadSubject = new ReplaySubject();
|
||||
this.onLoadSubject = new Subject();
|
||||
this.onLoad = this.onLoadSubject.asObservable();
|
||||
|
||||
extensionService.setup$.subscribe((config) => {
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { ThemePalette } from '@angular/material/core';
|
||||
import { AppConfigService } from '../../../app-config/app-config.service';
|
||||
import { filter, take } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-layout-header',
|
||||
@@ -64,14 +63,6 @@ export class HeaderLayoutComponent implements OnInit {
|
||||
constructor(
|
||||
private appConfigService: AppConfigService
|
||||
) {
|
||||
this.appConfigService.select('headerTextColor')
|
||||
.pipe(
|
||||
filter((textColor) => !!textColor),
|
||||
take(1)
|
||||
)
|
||||
.subscribe((textColor) => {
|
||||
document.documentElement.style.setProperty('--theme-header-text-color', textColor);
|
||||
});
|
||||
}
|
||||
|
||||
toggleMenu() {
|
||||
@@ -80,6 +71,11 @@ export class HeaderLayoutComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const textColor = this.appConfigService.get<string | undefined>('headerTextColor');
|
||||
if (textColor) {
|
||||
document.documentElement.style.setProperty('--theme-header-text-color', textColor);
|
||||
}
|
||||
|
||||
if (!this.logo) {
|
||||
this.logo = './assets/images/logo.png';
|
||||
}
|
||||
|
Reference in New Issue
Block a user