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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 7 deletions

View File

@ -86,7 +86,6 @@ The default logo displayed in the top left corner of the Alfresco Content Applic
```json
{
...,
"application": {
"logo": "/assets/images/alfresco-logo-white.svg"
}
@ -99,8 +98,21 @@ You can change the header background color by specifying the color code for the
```json
{
...,
"headerColor": "#ffffff"
"application": {
"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",
}
}
```

View File

@ -43,6 +43,11 @@ export const getLogoPath = createSelector(
state => state.logoPath
);
export const getHeaderImagePath = createSelector(
selectApp,
state => state.headerImagePath
);
export const getLanguagePickerState = createSelector(
selectApp,
state => state.languagePicker

View File

@ -34,6 +34,7 @@ export interface AppState {
appName: string;
headerColor: string;
logoPath: string;
headerImagePath: string;
languagePicker: boolean;
sharedUrl: string;
selection: SelectionState;

View File

@ -21,6 +21,7 @@
"name": "Alfresco Content Application",
"version": "1.11.0",
"logo": "assets/images/alfresco-logo-flower.svg",
"headerImagePath": "assets/images/mastHead-bg-shapesPattern.svg",
"copyright": "APP.COPYRIGHT"
},
"viewer.maxRetries": 1,

View File

@ -184,6 +184,7 @@ export class AppComponent implements OnInit, OnDestroy {
appName: this.config.get<string>('application.name'),
headerColor: this.config.get<string>('headerColor'),
logoPath: this.config.get<string>('application.logo'),
headerImagePath: this.config.get<string>('application.headerImagePath'),
sharedUrl: baseShareUrl
};

View File

@ -8,7 +8,7 @@
z-index: 2;
.mat-toolbar {
background-image: url('/assets/images/mastHead-bg-shapesPattern.svg') !important;
background-image: var(--header-background-image) !important;
background-repeat: no-repeat !important;
.adf-app-title {

View File

@ -39,7 +39,8 @@ import {
AppStore,
getHeaderColor,
getAppName,
getLogoPath
getLogoPath,
getHeaderImagePath
} from '@alfresco/aca-shared/store';
@Component({
@ -68,6 +69,13 @@ export class AppHeaderComponent implements OnInit {
this.headerColor$ = store.select(getHeaderColor);
this.appName$ = store.select(getAppName);
this.logo$ = store.select(getLogoPath);
store.select(getHeaderImagePath).subscribe(path => {
document.body.style.setProperty(
'--header-background-image',
`url('${path}')`
);
});
}
ngOnInit() {

View File

@ -29,6 +29,7 @@ export const INITIAL_APP_STATE: AppState = {
appName: 'Alfresco Content Application',
headerColor: '#ffffff',
logoPath: 'assets/images/alfresco-logo-white.svg',
headerImagePath: 'assets/images/mastHead-bg-shapesPattern.svg',
languagePicker: false,
sharedUrl: '',
user: {

View File

@ -89,10 +89,11 @@ $defaults: (
--theme-text-color: mat-color($foreground, text, 0.54),
--theme-title-color: mat-color($foreground, text, 0.87),
--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 {
@each $name, $value in $defaults {
#{$name}: #{$value};