From a55052c9baf2952795685d3b4e5348c8cb9da70d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Mar 2019 13:53:51 +0100 Subject: Add my library section in menu --- client/src/app/shared/menu/top-menu-dropdown.component.html | 6 +++++- client/src/app/shared/menu/top-menu-dropdown.component.scss | 9 +++++++++ client/src/app/shared/menu/top-menu-dropdown.component.ts | 10 +++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/menu') diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.html b/client/src/app/shared/menu/top-menu-dropdown.component.html index d3c896019..8d58fa1db 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.html +++ b/client/src/app/shared/menu/top-menu-dropdown.component.html @@ -13,7 +13,11 @@
- {{ menuChild.label }} + + + + {{ menuChild.label }} +
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.scss b/client/src/app/shared/menu/top-menu-dropdown.component.scss index 77159532f..d7c7de957 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.scss +++ b/client/src/app/shared/menu/top-menu-dropdown.component.scss @@ -1,3 +1,6 @@ +@import '_variables'; +@import '_mixins'; + .parent-entry { span[role=button] { cursor: pointer; @@ -16,3 +19,9 @@ /deep/ .dropdown-menu { margin-top: 0 !important; } + +.icon { + @include dropdown-with-icon-item; + + top: -1px; +} diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.ts b/client/src/app/shared/menu/top-menu-dropdown.component.ts index e859c30dd..e951ea236 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.ts +++ b/client/src/app/shared/menu/top-menu-dropdown.component.ts @@ -3,6 +3,7 @@ import { filter, take } from 'rxjs/operators' import { NavigationEnd, Router } from '@angular/router' import { Subscription } from 'rxjs' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' +import { GlobalIconName } from '@app/shared/images/global-icon.component' export type TopMenuDropdownParam = { label: string @@ -11,6 +12,8 @@ export type TopMenuDropdownParam = { children?: { label: string routerLink: string + + iconName?: GlobalIconName }[] } @@ -23,6 +26,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { @Input() menuEntries: TopMenuDropdownParam[] = [] suffixLabels: { [ parentLabel: string ]: string } + hasIcons = false private openedOnHover = false private routeSub: Subscription @@ -35,6 +39,10 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { this.routeSub = this.router.events .pipe(filter(event => event instanceof NavigationEnd)) .subscribe(() => this.updateChildLabels(window.location.pathname)) + + this.hasIcons = this.menuEntries.some( + e => e.children && e.children.some(c => !!c.iconName) + ) } ngOnDestroy () { @@ -48,7 +56,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { // Menu was closed dropdown.openChange .pipe(take(1)) - .subscribe(e => this.openedOnHover = false) + .subscribe(() => this.openedOnHover = false) } dropdownAnchorClicked (dropdown: NgbDropdown) { -- cgit v1.2.3