[Library | angular-14]: navigationBar.component: Added field "public featuredAlignment: string = MenuAlignment.CENTER.valueOf();" and align custom menu according to this, dynamically.

This commit is contained in:
Konstantina Galouni 2022-12-09 16:49:07 +02:00
parent acdba43c8b
commit 53a39d0a34
2 changed files with 17 additions and 15 deletions

View File

@ -289,17 +289,17 @@
<div class="uk-background-primary uk-light">
<div class="uk-container uk-container-expand">
<div class="uk-navbar" uk-navbar="delay-hide: 400">
<div class="uk-navbar-right">
<ul class="uk-navbar-nav">
<ng-container *ngFor="let item of featuredMenuItems">
<li [class.uk-active]="isTheActiveMenu(item)" [ngClass]="item.customClass">
<a *ngIf="item.type == 'internal' && item.route && isEnabled([item.route], showPage)"
routerLink="{{item.route}}"
[queryParams]="item.params"
[fragment]="item.fragment">
{{item.title}}
</a>
<a *ngIf="item.type == 'external' && item.url"
<div [ngClass]="'uk-navbar-'+featuredAlignment.toLowerCase()">
<ul class="uk-navbar-nav">
<ng-container *ngFor="let item of featuredMenuItems">
<li [class.uk-active]="isTheActiveMenu(item)" [ngClass]="item.customClass">
<a *ngIf="item.type == 'internal' && item.route && isEnabled([item.route], showPage)"
routerLink="{{item.route}}"
[queryParams]="item.params"
[fragment]="item.fragment">
{{item.title}}
</a>
<a *ngIf="item.type == 'external' && item.url"
href="{{item.url}}" class="custom-external"
target="_blank">
{{item.title}}

View File

@ -2,7 +2,7 @@ import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Session, User} from '../login/utils/helper.class';
import {ConfigurationService} from '../utils/configuration/configuration.service';
import {MenuItem} from './menu';
import {MenuAlignment, MenuItem} from './menu';
import {EnvProperties} from '../utils/properties/env-properties';
import {Subscription} from 'rxjs';
import {HelpContentService} from '../services/help-content.service';
@ -59,7 +59,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
public additionalMenuItems: MenuItem[] = [];
public featuredMenuItems: MenuItem[] = [];
public isMenuEnabled: boolean = false;
public isFeaturedMenuEnabled: boolean = false;
public isFeaturedMenuEnabled: boolean = false;
public featuredAlignment: string = MenuAlignment.CENTER.valueOf();
constructor(private router: Router,
private route: ActivatedRoute,
@ -124,8 +125,9 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
this._helpContentService.getMenuItems(this.portal).subscribe(
data => {
this.isMenuEnabled = data.isMenuEnabled;
this.isFeaturedMenuEnabled = data.isFeaturedMenuEnabled;
this.featuredMenuItems = data.featuredMenuItems;
this.isFeaturedMenuEnabled = data.isFeaturedMenuEnabled;
this.featuredAlignment = data.featuredAlignment;
this.featuredMenuItems = data.featuredMenuItems;
this.additionalMenuItems = data.menuItems;
},
error => this.handleError("Server error fetching custom menu items", error)