customisable header image url (#1449)

This commit is contained in:
Denys Vuika
2020-05-06 14:17:42 +01:00
committed by GitHub
parent 9c3f3b5987
commit f6c1843b23
9 changed files with 37 additions and 7 deletions
+14 -2
View File
@@ -86,7 +86,6 @@ The default logo displayed in the top left corner of the Alfresco Content Applic
```json ```json
{ {
...,
"application": { "application": {
"logo": "/assets/images/alfresco-logo-white.svg" "logo": "/assets/images/alfresco-logo-white.svg"
} }
@@ -99,9 +98,22 @@ You can change the header background color by specifying the color code for the
```json ```json
{ {
..., "application": {
"headerColor": "#ffffff" "headerColor": "#ffffff"
} }
}
```
### Header background image
You can change the header background image by specifying the path to the corresponding resource:
```json
{
"application": {
"headerImagePath": "assets/images/mastHead-bg-shapesPattern.svg",
}
}
``` ```
### Restricted content ### Restricted content
@@ -43,6 +43,11 @@ export const getLogoPath = createSelector(
state => state.logoPath state => state.logoPath
); );
export const getHeaderImagePath = createSelector(
selectApp,
state => state.headerImagePath
);
export const getLanguagePickerState = createSelector( export const getLanguagePickerState = createSelector(
selectApp, selectApp,
state => state.languagePicker state => state.languagePicker
@@ -34,6 +34,7 @@ export interface AppState {
appName: string; appName: string;
headerColor: string; headerColor: string;
logoPath: string; logoPath: string;
headerImagePath: string;
languagePicker: boolean; languagePicker: boolean;
sharedUrl: string; sharedUrl: string;
selection: SelectionState; selection: SelectionState;
+1
View File
@@ -21,6 +21,7 @@
"name": "Alfresco Content Application", "name": "Alfresco Content Application",
"version": "1.11.0", "version": "1.11.0",
"logo": "assets/images/alfresco-logo-flower.svg", "logo": "assets/images/alfresco-logo-flower.svg",
"headerImagePath": "assets/images/mastHead-bg-shapesPattern.svg",
"copyright": "APP.COPYRIGHT" "copyright": "APP.COPYRIGHT"
}, },
"viewer.maxRetries": 1, "viewer.maxRetries": 1,
+1
View File
@@ -184,6 +184,7 @@ export class AppComponent implements OnInit, OnDestroy {
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'),
logoPath: this.config.get<string>('application.logo'), logoPath: this.config.get<string>('application.logo'),
headerImagePath: this.config.get<string>('application.headerImagePath'),
sharedUrl: baseShareUrl sharedUrl: baseShareUrl
}; };
@@ -8,7 +8,7 @@
z-index: 2; z-index: 2;
.mat-toolbar { .mat-toolbar {
background-image: url('/assets/images/mastHead-bg-shapesPattern.svg') !important; background-image: var(--header-background-image) !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
.adf-app-title { .adf-app-title {
@@ -39,7 +39,8 @@ import {
AppStore, AppStore,
getHeaderColor, getHeaderColor,
getAppName, getAppName,
getLogoPath getLogoPath,
getHeaderImagePath
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
@Component({ @Component({
@@ -68,6 +69,13 @@ export class AppHeaderComponent implements OnInit {
this.headerColor$ = store.select(getHeaderColor); this.headerColor$ = store.select(getHeaderColor);
this.appName$ = store.select(getAppName); this.appName$ = store.select(getAppName);
this.logo$ = store.select(getLogoPath); this.logo$ = store.select(getLogoPath);
store.select(getHeaderImagePath).subscribe(path => {
document.body.style.setProperty(
'--header-background-image',
`url('${path}')`
);
});
} }
ngOnInit() { ngOnInit() {
+1
View File
@@ -29,6 +29,7 @@ export const INITIAL_APP_STATE: AppState = {
appName: 'Alfresco Content Application', appName: 'Alfresco Content Application',
headerColor: '#ffffff', headerColor: '#ffffff',
logoPath: 'assets/images/alfresco-logo-white.svg', logoPath: 'assets/images/alfresco-logo-white.svg',
headerImagePath: 'assets/images/mastHead-bg-shapesPattern.svg',
languagePicker: false, languagePicker: false,
sharedUrl: '', sharedUrl: '',
user: { user: {
+3 -2
View File
@@ -89,10 +89,11 @@ $defaults: (
--theme-text-color: mat-color($foreground, text, 0.54), --theme-text-color: mat-color($foreground, text, 0.54),
--theme-title-color: mat-color($foreground, text, 0.87), --theme-title-color: mat-color($foreground, text, 0.87),
--theme-text-disabled-color: mat-color($foreground, text, 0.38), --theme-text-disabled-color: mat-color($foreground, text, 0.38),
--theme-border-color: mat-color($foreground, text, 0.07) --theme-border-color: mat-color($foreground, text, 0.07),
--header-background-image: url('assets/images/mastHead-bg-shapesPattern.svg')
); );
// defaults // propagates SCSS variables into the CSS variables scope
:root { :root {
@each $name, $value in $defaults { @each $name, $value in $defaults {
#{$name}: #{$value}; #{$name}: #{$value};