Fix a bug with replace header in navbar. Page content add header and actions class in order to handle border bottom in tabs

This commit is contained in:
Konstantinos Triantafyllou 2022-12-12 16:16:47 +02:00
parent 203c3b71c7
commit 37545606a0
3 changed files with 26 additions and 8 deletions

View File

@ -30,16 +30,20 @@ declare var ResizeObserver;
[attr.uk-sticky]="(headerSticky && shouldSticky)?'media: @m':null" [attr.offset]="offset"
[attr.style]="'margin-top: '+(footer_height? '-'+footer_height+'px': '0')">
<div class="uk-container uk-container-large">
<div class="uk-padding-small uk-padding-remove-vertical">
<ng-content select="[header]"></ng-content>
<div class="uk-padding-small uk-padding-remove-vertical uk-padding-remove-right">
<div class="header">
<ng-content select="[header]"></ng-content>
</div>
</div>
</div>
</div>
<div id="page_content_actions" #actions class="uk-blur-background"
[attr.uk-sticky]="(!headerSticky && shouldSticky)?'media: @m':null" [attr.offset]="offset">
<div class="uk-container uk-container-large">
<div class="uk-padding-small uk-padding-remove-vertical">
<ng-content select="[actions]"></ng-content>
<div class="uk-padding-small uk-padding-remove-vertical uk-padding-remove-right">
<div class="actions">
<ng-content select="[actions]"></ng-content>
</div>
</div>
</div>
</div>

View File

@ -208,6 +208,10 @@ export class LayoutService {
return this.replaceHeaderSubject.asObservable();
}
get replaceHeaderValue(): boolean {
return this.replaceHeaderSubject.getValue();
}
setReplaceHeader(value: boolean) {
this.replaceHeaderSubject.next(value);
}

View File

@ -1,4 +1,4 @@
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Session, User} from '../login/utils/helper.class';
import {ConfigurationService} from '../utils/configuration/configuration.service';
@ -29,7 +29,7 @@ export interface Header {
selector: 'navbar',
templateUrl: 'navigationBar.component.html'
})
export class NavigationBarComponent implements OnInit, OnDestroy {
export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges {
@Input() portal: string = 'connect';
@Input() onlyTop: boolean = false;
@Input() logoPath: string = 'assets/common-assets/';
@ -77,6 +77,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
sub.unsubscribe();
}
}
ngOnChanges(changes: SimpleChanges) {
if(changes.header) {
this.setHeader(this.layoutService.replaceHeaderValue);
}
}
closeCanvas(element) {
UIkit.offcanvas(element).hide();
@ -135,11 +141,15 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
);
}
this.subs.push(this.layoutService.replaceHeader.subscribe(replaceHeader => {
this.replaceHeader = this.header.replaceHeader && replaceHeader;
this.activeHeader = this.replaceHeader?this.header.replaceHeader:this.header;
this.setHeader(replaceHeader);
}));
}
setHeader(replaceHeader: boolean) {
this.replaceHeader = this.header.replaceHeader && replaceHeader;
this.activeHeader = this.replaceHeader?this.header.replaceHeader:this.header;
}
isEnabled(required, enabled) {
if (!required) {
return true;