mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[AAE-6057] Customize text color in the header (#2326)
* [AAE-6057] Customize text color in the header * [AAE-6057] use css vars * [AAE-6057] added tests * [AAE-6057] clear code * [AAE-6057] quick fix * [AAE-6057] update css so they wark nicly with new --adf-header-text-color
This commit is contained in:
parent
47921d9b3c
commit
bc626798d5
@ -1,4 +1,7 @@
|
|||||||
.aca-toolbar-action {
|
.aca-toolbar-action {
|
||||||
color: var(--theme-foreground-text-color);
|
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
|
|
||||||
|
adf-userinfo {
|
||||||
|
color: var(--theme-foreground-text-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import { createSelector } from '@ngrx/store';
|
|||||||
export const selectApp = (state: AppStore) => state.app;
|
export const selectApp = (state: AppStore) => state.app;
|
||||||
|
|
||||||
export const getHeaderColor = createSelector(selectApp, (state) => state.headerColor);
|
export const getHeaderColor = createSelector(selectApp, (state) => state.headerColor);
|
||||||
|
export const getHeaderTextColor = createSelector(selectApp, (state) => state.headerTextColor);
|
||||||
export const getAppName = createSelector(selectApp, (state) => state.appName);
|
export const getAppName = createSelector(selectApp, (state) => state.appName);
|
||||||
export const getLogoPath = createSelector(selectApp, (state) => state.logoPath);
|
export const getLogoPath = createSelector(selectApp, (state) => state.logoPath);
|
||||||
export const getHeaderImagePath = createSelector(selectApp, (state) => state.headerImagePath);
|
export const getHeaderImagePath = createSelector(selectApp, (state) => state.headerImagePath);
|
||||||
|
@ -29,6 +29,7 @@ import { RepositoryInfo, VersionEntry } from '@alfresco/js-api';
|
|||||||
export interface AppState {
|
export interface AppState {
|
||||||
appName: string;
|
appName: string;
|
||||||
headerColor: string;
|
headerColor: string;
|
||||||
|
headerTextColor: string;
|
||||||
logoPath: string;
|
logoPath: string;
|
||||||
headerImagePath: string;
|
headerImagePath: string;
|
||||||
sharedUrl: string;
|
sharedUrl: string;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"viewer.maxRetries": 1,
|
"viewer.maxRetries": 1,
|
||||||
"sharedLinkDateTimePickerType": "date",
|
"sharedLinkDateTimePickerType": "date",
|
||||||
"headerColor": "#ffffff",
|
"headerColor": "#ffffff",
|
||||||
|
"headerTextColor": "#000000",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
"size": 25,
|
"size": 25,
|
||||||
"supportedPageSizes": [25, 50, 100]
|
"supportedPageSizes": [25, 50, 100]
|
||||||
|
@ -161,6 +161,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
...INITIAL_APP_STATE,
|
...INITIAL_APP_STATE,
|
||||||
appName: this.config.get<string>('application.name'),
|
appName: this.config.get<string>('application.name'),
|
||||||
headerColor: this.config.get<string>('headerColor'),
|
headerColor: this.config.get<string>('headerColor'),
|
||||||
|
headerTextColor: this.config.get<string>('headerTextColor', '#000000'),
|
||||||
logoPath: this.config.get<string>('application.logo'),
|
logoPath: this.config.get<string>('application.logo'),
|
||||||
headerImagePath: this.config.get<string>('application.headerImagePath'),
|
headerImagePath: this.config.get<string>('application.headerImagePath'),
|
||||||
sharedUrl: baseShareUrl
|
sharedUrl: baseShareUrl
|
||||||
|
@ -6,14 +6,6 @@
|
|||||||
background-image: var(--header-background-image) !important;
|
background-image: var(--header-background-image) !important;
|
||||||
background-repeat: no-repeat !important;
|
background-repeat: no-repeat !important;
|
||||||
|
|
||||||
.adf-app-title {
|
|
||||||
color: var(--theme-foreground-text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-menu-icon {
|
|
||||||
color: var(--theme-foreground-text-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aca-current-user {
|
.aca-current-user {
|
||||||
color: var(--theme-foreground-text-color) !important;
|
color: var(--theme-foreground-text-color) !important;
|
||||||
}
|
}
|
||||||
@ -21,9 +13,5 @@
|
|||||||
.adf-toolbar-divider div {
|
.adf-toolbar-divider div {
|
||||||
background-color: var(--theme-foreground-text-color) !important;
|
background-color: var(--theme-foreground-text-color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-toolbar-menu {
|
|
||||||
color: var(--theme-foreground-text-color) !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ describe('AppHeaderComponent', () => {
|
|||||||
|
|
||||||
const app = {
|
const app = {
|
||||||
headerColor: 'some-color',
|
headerColor: 'some-color',
|
||||||
|
headerTextColor: 'text-color',
|
||||||
appName: 'name',
|
appName: 'name',
|
||||||
logoPath: 'some/path'
|
logoPath: 'some/path'
|
||||||
} as AppState;
|
} as AppState;
|
||||||
@ -82,10 +83,11 @@ describe('AppHeaderComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set header color, name and logo', fakeAsync(() => {
|
it('should set header color, header text color, name and logo', fakeAsync(() => {
|
||||||
component.appName$.subscribe((val) => expect(val).toBe(app.appName));
|
component.appName$.subscribe((val) => expect(val).toBe(app.appName));
|
||||||
component.logo$.subscribe((val) => expect(val).toBe(app.logoPath));
|
component.logo$.subscribe((val) => expect(val).toBe(app.logoPath));
|
||||||
component.headerColor$.subscribe((val) => expect(val).toBe(app.headerColor));
|
component.headerColor$.subscribe((val) => expect(val).toBe(app.headerColor));
|
||||||
|
component.headerTextColor$.subscribe((val) => expect(val).toBe(app.headerTextColor));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should get header actions', fakeAsync(() => {
|
it('should get header actions', fakeAsync(() => {
|
||||||
|
@ -27,7 +27,7 @@ import { Component, ViewEncapsulation, Output, EventEmitter, OnInit, Input, OnDe
|
|||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath } from '@alfresco/aca-shared/store';
|
import { AppStore, getHeaderColor, getAppName, getLogoPath, getHeaderImagePath, getHeaderTextColor } from '@alfresco/aca-shared/store';
|
||||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@ -47,12 +47,14 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
appName$: Observable<string>;
|
appName$: Observable<string>;
|
||||||
headerColor$: Observable<any>;
|
headerColor$: Observable<any>;
|
||||||
|
headerTextColor$: Observable<string>;
|
||||||
logo$: Observable<string>;
|
logo$: Observable<string>;
|
||||||
|
|
||||||
actions: Array<ContentActionRef> = [];
|
actions: Array<ContentActionRef> = [];
|
||||||
|
|
||||||
constructor(store: Store<AppStore>, private appExtensions: AppExtensionService) {
|
constructor(store: Store<AppStore>, private appExtensions: AppExtensionService) {
|
||||||
this.headerColor$ = store.select(getHeaderColor);
|
this.headerColor$ = store.select(getHeaderColor);
|
||||||
|
this.headerTextColor$ = store.select(getHeaderTextColor);
|
||||||
this.appName$ = store.select(getAppName);
|
this.appName$ = store.select(getAppName);
|
||||||
this.logo$ = store.select(getLogoPath);
|
this.logo$ = store.select(getLogoPath);
|
||||||
|
|
||||||
@ -68,6 +70,10 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.headerTextColor$.subscribe((color) => {
|
||||||
|
document.documentElement.style.setProperty('--adf-header-text-color', color);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -28,6 +28,7 @@ import { AppState, AppStore } from '@alfresco/aca-shared/store';
|
|||||||
export const INITIAL_APP_STATE: AppState = {
|
export const INITIAL_APP_STATE: AppState = {
|
||||||
appName: 'Alfresco Content Application',
|
appName: 'Alfresco Content Application',
|
||||||
headerColor: '#ffffff',
|
headerColor: '#ffffff',
|
||||||
|
headerTextColor: '#000000',
|
||||||
logoPath: 'assets/images/alfresco-logo-white.svg',
|
logoPath: 'assets/images/alfresco-logo-white.svg',
|
||||||
headerImagePath: 'assets/images/mastHead-bg-shapesPattern.svg',
|
headerImagePath: 'assets/images/mastHead-bg-shapesPattern.svg',
|
||||||
sharedUrl: '',
|
sharedUrl: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user