From 9f2a1d048bd3a9a413cc15492ce6bbf6c4dd65b2 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Tue, 26 Sep 2023 11:50:29 +0200 Subject: [PATCH 1/4] Use gap instead of individual paddings for header icons --- .../context-help-toggle.component.ts | 19 ++++++++--- src/app/header/header.component.html | 4 +-- src/app/header/header.component.scss | 4 +++ src/app/header/header.component.spec.ts | 5 ++- src/app/header/header.component.ts | 14 +++++--- .../search-navbar.component.html | 4 +-- .../search-navbar.component.scss | 1 + src/app/shared/animations/slide.ts | 2 +- .../auth-nav-menu.component.html | 4 +-- .../impersonate-navbar.component.html | 2 +- .../impersonate-navbar.component.spec.ts | 3 +- .../impersonate-navbar.component.ts | 33 ++++++++++++------- .../lang-switch/lang-switch.component.html | 2 +- .../lang-switch/lang-switch.component.ts | 8 +++-- src/styles/_global-styles.scss | 26 +++++++++++++++ 15 files changed, 97 insertions(+), 34 deletions(-) diff --git a/src/app/header/context-help-toggle/context-help-toggle.component.ts b/src/app/header/context-help-toggle/context-help-toggle.component.ts index 6685df71063..de7c994faa5 100644 --- a/src/app/header/context-help-toggle/context-help-toggle.component.ts +++ b/src/app/header/context-help-toggle/context-help-toggle.component.ts @@ -1,6 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ElementRef } from '@angular/core'; import { ContextHelpService } from '../../shared/context-help.service'; -import { Observable } from 'rxjs'; +import { Observable, Subscription } from 'rxjs'; import { map } from 'rxjs/operators'; /** @@ -15,12 +15,23 @@ import { map } from 'rxjs/operators'; export class ContextHelpToggleComponent implements OnInit { buttonVisible$: Observable; + subscriptions: Subscription[] = []; + constructor( - private contextHelpService: ContextHelpService, - ) { } + protected elRef: ElementRef, + protected contextHelpService: ContextHelpService, + ) { + } ngOnInit(): void { this.buttonVisible$ = this.contextHelpService.tooltipCount$().pipe(map(x => x > 0)); + this.subscriptions.push(this.buttonVisible$.subscribe((showContextHelpToggle: boolean) => { + if (showContextHelpToggle) { + this.elRef.nativeElement.classList.remove('d-none'); + } else { + this.elRef.nativeElement.classList.add('d-none'); + } + })); } onClick() { diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html index 4d879835235..425f52c6017 100644 --- a/src/app/header/header.component.html +++ b/src/app/header/header.component.html @@ -11,8 +11,8 @@ -
- diff --git a/src/app/search-navbar/search-navbar.component.scss b/src/app/search-navbar/search-navbar.component.scss index cf46c25d914..a276482b535 100644 --- a/src/app/search-navbar/search-navbar.component.scss +++ b/src/app/search-navbar/search-navbar.component.scss @@ -12,6 +12,7 @@ input[type="text"] { cursor: pointer; position: sticky; top: 0; + border: 0 !important; color: var(--ds-header-icon-color); &:hover, &:focus { diff --git a/src/app/shared/animations/slide.ts b/src/app/shared/animations/slide.ts index 310ddbbfde9..9d18817ee39 100644 --- a/src/app/shared/animations/slide.ts +++ b/src/app/shared/animations/slide.ts @@ -55,7 +55,7 @@ export const slideSidebarPadding = trigger('slideSidebarPadding', [ export const expandSearchInput = trigger('toggleAnimation', [ state('collapsed', style({ - width: '30px', + width: '0', opacity: '0' })), state('expanded', style({ diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html index 05f502afa1b..bbc4fa3ca70 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html @@ -2,7 +2,7 @@ diff --git a/src/app/shared/impersonate-navbar/impersonate-navbar.component.html b/src/app/shared/impersonate-navbar/impersonate-navbar.component.html index 9f2b66694b7..9581ba8ea87 100644 --- a/src/app/shared/impersonate-navbar/impersonate-navbar.component.html +++ b/src/app/shared/impersonate-navbar/impersonate-navbar.component.html @@ -1,4 +1,4 @@ -
- + From 58d31dd73f9762a341e774df261d909d97c4b3e2 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Tue, 26 Sep 2023 22:16:25 +0200 Subject: [PATCH 3/4] Applied same gap between header icons in the dspace theme and made the search field non-focusable when collapsed --- src/app/header/header.component.scss | 3 ++- src/app/search-navbar/search-navbar.component.html | 5 ++++- src/themes/dspace/app/header/header.component.html | 2 +- src/themes/dspace/app/header/header.component.scss | 6 ++++++ src/themes/dspace/app/navbar/navbar.component.html | 12 +++++++----- src/themes/dspace/app/navbar/navbar.component.scss | 6 ++++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/app/header/header.component.scss b/src/app/header/header.component.scss index 8a11a651956..871adf289c6 100644 --- a/src/app/header/header.component.scss +++ b/src/app/header/header.component.scss @@ -22,5 +22,6 @@ .navbar { display: flex; - gap: 0.25rem; + gap: calc(var(--bs-spacer) / 3); + align-items: center; } diff --git a/src/app/search-navbar/search-navbar.component.html b/src/app/search-navbar/search-navbar.component.html index 8a98d4c44c4..02a98905021 100644 --- a/src/app/search-navbar/search-navbar.component.html +++ b/src/app/search-navbar/search-navbar.component.html @@ -3,7 +3,10 @@ + class="bg-transparent position-absolute form-control dropdown-menu-right pl-1 pr-4" + [class.display]="searchExpanded ? 'inline-block' : 'none'" + [tabIndex]="searchExpanded ? 0 : -1" + [attr.data-test]="'header-search-box' | dsBrowserOnly"> diff --git a/src/themes/dspace/app/header/header.component.html b/src/themes/dspace/app/header/header.component.html index 87a26ca326a..4b0046bc834 100644 --- a/src/themes/dspace/app/header/header.component.html +++ b/src/themes/dspace/app/header/header.component.html @@ -5,7 +5,7 @@ -
+ - - - - - +
diff --git a/src/themes/dspace/app/navbar/navbar.component.scss b/src/themes/dspace/app/navbar/navbar.component.scss index d3aea9f0780..2e1b4a04f92 100644 --- a/src/themes/dspace/app/navbar/navbar.component.scss +++ b/src/themes/dspace/app/navbar/navbar.component.scss @@ -54,3 +54,9 @@ a.navbar-brand img { color: var(--ds-navbar-link-color-hover); } } + +.navbar-buttons { + display: flex; + gap: calc(var(--bs-spacer) / 3); + align-items: center; +} From fa56d5dfb719c14d99080ef8fe208b5ee129c72f Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Thu, 28 Sep 2023 11:50:24 +0200 Subject: [PATCH 4/4] Fixed invalid html structure the ExpandableNavbarSectionComponent had an ul tag containing non-li tags --- .../admin-sidebar-section/admin-sidebar-section.component.ts | 3 +-- src/app/admin/admin-sidebar/admin-sidebar.component.html | 4 ++-- .../expandable-admin-sidebar-section.component.ts | 3 +-- .../expandable-navbar-section.component.html | 4 ++-- .../expandable-navbar-section.component.ts | 2 -- .../themed-expandable-navbar-section.component.ts | 3 +-- src/app/navbar/navbar-section/navbar-section.component.ts | 3 +-- src/app/navbar/navbar.component.html | 4 ++-- .../dso-edit-menu-expandable-section.component.ts | 1 - .../dso-edit-menu-section/dso-edit-menu-section.component.ts | 1 - src/themes/dspace/app/navbar/navbar.component.html | 4 ++-- 11 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts index d6cd803622b..b195526d1c0 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts @@ -12,8 +12,7 @@ import { Router } from '@angular/router'; * Represents a non-expandable section in the admin sidebar */ @Component({ - /* eslint-disable @angular-eslint/component-selector */ - selector: 'li[ds-admin-sidebar-section]', + selector: 'ds-admin-sidebar-section', templateUrl: './admin-sidebar-section.component.html', styleUrls: ['./admin-sidebar-section.component.scss'], diff --git a/src/app/admin/admin-sidebar/admin-sidebar.component.html b/src/app/admin/admin-sidebar/admin-sidebar.component.html index ef220b834ba..fe7e5595ab0 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar.component.html +++ b/src/app/admin/admin-sidebar/admin-sidebar.component.html @@ -26,10 +26,10 @@

{{ 'menu.header.admin' | translate }}

- +
  • - +
  • diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.ts b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.ts index 5bc69bcbb4e..d32fa46a327 100644 --- a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.ts +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.ts @@ -4,7 +4,6 @@ import { MenuService } from '../../shared/menu/menu.service'; import { slide } from '../../shared/animations/slide'; import { first } from 'rxjs/operators'; import { HostWindowService } from '../../shared/host-window.service'; -import { rendersSectionForMenu } from '../../shared/menu/menu-section.decorator'; import { MenuID } from '../../shared/menu/menu-id.model'; /** @@ -16,7 +15,6 @@ import { MenuID } from '../../shared/menu/menu-id.model'; styleUrls: ['./expandable-navbar-section.component.scss'], animations: [slide] }) -@rendersSectionForMenu(MenuID.PUBLIC, true) export class ExpandableNavbarSectionComponent extends NavbarSectionComponent implements OnInit { /** * This section resides in the Public Navbar diff --git a/src/app/navbar/expandable-navbar-section/themed-expandable-navbar-section.component.ts b/src/app/navbar/expandable-navbar-section/themed-expandable-navbar-section.component.ts index e33dca41049..8f474e99490 100644 --- a/src/app/navbar/expandable-navbar-section/themed-expandable-navbar-section.component.ts +++ b/src/app/navbar/expandable-navbar-section/themed-expandable-navbar-section.component.ts @@ -8,8 +8,7 @@ import { MenuID } from '../../shared/menu/menu-id.model'; * Themed wrapper for ExpandableNavbarSectionComponent */ @Component({ - /* eslint-disable @angular-eslint/component-selector */ - selector: 'li[ds-themed-expandable-navbar-section]', + selector: 'ds-themed-expandable-navbar-section', styleUrls: [], templateUrl: '../../shared/theme-support/themed.component.html', }) diff --git a/src/app/navbar/navbar-section/navbar-section.component.ts b/src/app/navbar/navbar-section/navbar-section.component.ts index 9f75a96f6e7..9b86aa10f2b 100644 --- a/src/app/navbar/navbar-section/navbar-section.component.ts +++ b/src/app/navbar/navbar-section/navbar-section.component.ts @@ -8,8 +8,7 @@ import { MenuID } from '../../shared/menu/menu-id.model'; * Represents a non-expandable section in the navbar */ @Component({ - /* eslint-disable @angular-eslint/component-selector */ - selector: 'li[ds-navbar-section]', + selector: 'ds-navbar-section', templateUrl: './navbar-section.component.html', styleUrls: ['./navbar-section.component.scss'] }) diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index bc1e04f5130..edfc4bb8ee0 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -8,9 +8,9 @@
  • - +
  • - +
  • diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts index 8e4a7008afe..1925099418a 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts @@ -13,7 +13,6 @@ import { hasValue } from '../../../empty.util'; * Represents an expandable section in the dso edit menus */ @Component({ - /* tslint:disable:component-selector */ selector: 'ds-dso-edit-menu-expandable-section', templateUrl: './dso-edit-menu-expandable-section.component.html', styleUrls: ['./dso-edit-menu-expandable-section.component.scss'], diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.ts b/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.ts index af3381ef716..060049ef5fc 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.ts +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.ts @@ -10,7 +10,6 @@ import { MenuSection } from '../../../menu/menu-section.model'; * Represents a non-expandable section in the dso edit menus */ @Component({ - /* tslint:disable:component-selector */ selector: 'ds-dso-edit-menu-section', templateUrl: './dso-edit-menu-section.component.html', styleUrls: ['./dso-edit-menu-section.component.scss'] diff --git a/src/themes/dspace/app/navbar/navbar.component.html b/src/themes/dspace/app/navbar/navbar.component.html index d9631aad182..c14671cf683 100644 --- a/src/themes/dspace/app/navbar/navbar.component.html +++ b/src/themes/dspace/app/navbar/navbar.component.html @@ -10,9 +10,9 @@
  • - +
  • - +