Skip to content

Commit

Permalink
Merge pull request #77 from gisktzh/feature/gb3-1724-hamburger-menu
Browse files Browse the repository at this point in the history
GB3-1724:  hamburger menu
  • Loading branch information
TIL-EBP authored Dec 11, 2024
2 parents bf26cc2 + f9b3775 commit 7f70740
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 127 deletions.
Original file line number Diff line number Diff line change
@@ -1,71 +1,77 @@
<mat-card class="navbar-mobile__dialog">
<mat-card-header class="navbar-mobile__dialog__header">
<a (click)="this.startLogin()" *ngIf="!this.isAuthenticated; else userProfile" class="navbar__item" mat-button>Login</a>
<ng-template #userProfile>
<a [matMenuTriggerFor]="userMenu" class="navbar__item" mat-button #trigger="matMenuTrigger">
@if (!isAuthenticated) {
<button (click)="startLogin()" class="navbar__item navbar__user" mat-button>
<mat-icon svgIcon="ktzh_user"></mat-icon>
<span>{{ this.userName }}</span>
<span>Login</span>
</button>
} @else {
<button [matMenuTriggerFor]="userMenu" class="navbar__item navbar__user" mat-button #trigger="matMenuTrigger">
<mat-icon svgIcon="ktzh_user"></mat-icon>
<span>{{ userName }}</span>
<mat-icon [fontIcon]="trigger.menuOpen ? 'arrow_drop_up' : 'arrow_drop_down'" class="arrow-icon"></mat-icon>
</a>
<mat-menu #userMenu="matMenu">
<button (click)="this.logout()" mat-menu-item>
</button>
<mat-menu #userMenu="matMenu" style="padding-left: 12px">
<a href="https://maps.zh.ch/groups_users" target="_blank" rel="noopener noreferrer" mat-menu-item>
<mat-icon svgIcon="ktzh_user"></mat-icon>
<span>Profil</span>
</a>
<mat-divider></mat-divider>
<button (click)="logout()" mat-menu-item>
<mat-icon>logout</mat-icon>
<span>Logout</span>
</button>
</mat-menu>
</ng-template>
}

<button mat-icon-button (click)="close()">
<mat-icon>close</mat-icon>
</button>
</mat-card-header>
<mat-card-content class="navbar-mobile__dialog__content">
<hr />
<a
[queryParams]="{}"
[routerLinkActiveOptions]="{exact: true}"
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Start]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Geoportal</a
>
<hr />
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Maps]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>GIS-Browser</a
>
<hr />
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Data]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Geodatenkatalog</a
>
<hr />
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Support]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Hilfe & Support</a
>
<hr />
<a class="navbar__item" href="https://geodatenshop.zh.ch" mat-button target="_blank" rel="noopener noreferrer" (click)="close()">
<mat-icon>launch</mat-icon>
Geodatenshop</a
>
<hr />
<div class="navbar-mobile__dialog__content__container">
<a
[queryParams]="{}"
[routerLinkActiveOptions]="{exact: true}"
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Start]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Geoportal</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Maps]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>GIS-Browser</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Data]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Geodatenkatalog</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Support]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
(click)="close()"
>Hilfe & Support</a
>
<a class="navbar__item" href="https://geodatenshop.zh.ch" mat-button target="_blank" rel="noopener noreferrer" (click)="close()">
<mat-icon>launch</mat-icon>
Geodatenshop</a
>
</div>
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
.navbar-mobile__dialog__header {
display: flex;
align-items: center;
margin-bottom: 32px;
padding: 16px 6px 0;
height: 72px;
padding: 0;

.navbar-mobile__dialog__header__title {
@include material-mixins.mat-icon-custom-svg-size(18px);
Expand All @@ -34,12 +34,19 @@

.navbar-mobile__dialog__content {
flex: 1;
overflow: hidden scroll;
padding: 0 6px;
overflow: auto;
padding: 0 12px;

.navbar-mobile__dialog__content__container {
display: flex;
flex-direction: column;
padding: 0;
border-top: 1px inset;
}
}
}

a.navbar__item {
.navbar__item {
font-family: ktzh-variables.$zh-font-family;
padding-left: 10px;
padding-right: 10px;
Expand All @@ -49,12 +56,18 @@ a.navbar__item {
font-size: 18px;
flex-grow: 1;
justify-content: flex-start;
height: 60px;

&.navbar__item--active {
font-family: ktzh-variables.$zh-font-family-bold;
}
}

.navbar__user {
margin-left: 12px;
padding-left: 12px;
}

.arrow-icon {
order: 2;
padding-left: 8px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<mat-toolbar *ngIf="!isSimplifiedPage; else simplifiedPage" class="navbar-mobile" color="primary">
<span class="navbar-mobile__item"> Geoportal Kanton Zürich </span>
<span class="navbar-mobile__spacer"></span>
<button class="navbar-mobile__item" mat-button (click)="showMenu()">
<span class="navbar-mobile__item__text">Menu</span>
@if (!isSimplifiedPage) {
<mat-toolbar class="navbar-mobile" color="primary">
<span class="navbar-mobile__item"> Geoportal Kanton Zürich </span>
<span class="navbar-mobile__spacer"></span>
<button class="navbar-mobile__item" mat-button (click)="showMenu()">
<span class="navbar-mobile__item__text">Menu</span>

<mat-icon svgIcon="ktzh_menu_mobile" iconPositionEnd>launch</mat-icon>
</button>
<div class="navbar-mobile__underline-container">
<div class="navbar-mobile__underline-container__content-container">
<span></span>
<span class="navbar-mobile__underline"></span>
<span class="navbar-mobile__underline"></span>
<mat-icon svgIcon="ktzh_menu_mobile" iconPositionEnd>launch</mat-icon>
</button>
<div class="navbar-mobile__underline-container">
<div class="navbar-mobile__underline-container__content-container">
<span></span>
<span class="navbar-mobile__underline"></span>
<span class="navbar-mobile__underline"></span>
</div>
</div>
</div>
</mat-toolbar>

<ng-template #simplifiedPage>
</mat-toolbar>
} @else {
<div class="navbar-mobile-simplified" [ngClass]="{'navbar-mobile-simplified--dev-mode': isDevModeActive}">
<button (click)="showMenu()" class="navbar-mobile-simplified__button" mat-icon-button>
<mat-icon svgIcon="ktzh_menu_mobile"></mat-icon>
</button>
</div>
</ng-template>
}
108 changes: 63 additions & 45 deletions src/app/shared/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar aria-label="Hauptnavigation" class="navbar" color="primary" role="navigation">
<span class="navbar__item" role="banner">
<img
[ngStyle]="{display: !this.isSimplifiedPage ? 'none' : 'inline'}"
[ngStyle]="{display: !isSimplifiedPage ? 'none' : 'inline'}"
alt="KTZH Logo"
class="navbar__logo"
ngSrc="assets/images/ktzh_inverted.svg"
Expand All @@ -12,57 +12,75 @@
Geoportal Kanton Zürich
</span>
<span class="navbar__spacer"></span>

<a
[queryParams]="{}"
[routerLinkActiveOptions]="{exact: true}"
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Start]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>Geoportal</a
>
<a class="navbar__item" mat-button [routerLink]="[mainPageEnum.Maps]" routerLinkActive="navbar__item--active" ariaCurrentWhenActive="page"
>GIS-Browser</a
>
<a class="navbar__item" mat-button [routerLink]="[mainPageEnum.Data]" routerLinkActive="navbar__item--active" ariaCurrentWhenActive="page"
>Geodatenkatalog</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Support]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>Hilfe & Support</a
>
<a class="navbar__item" href="https://geodatenshop.zh.ch" mat-button target="_blank" rel="noopener noreferrer">
<mat-icon>launch</mat-icon>
Geodatenshop
</a>
<mat-divider class="navbar__divider" vertical></mat-divider>
@if (!this.isAuthenticated) {
<button (click)="this.startLogin()" class="navbar__item navbar__item--button" mat-button>Login</button>
} @else {
@if (screenMode === 'regular') {
<button [matMenuTriggerFor]="userMenu" class="navbar__item navbar__item--button" mat-button>
<mat-icon svgIcon="ktzh_user"></mat-icon>
{{ this.userName }}
@if (screenMode === 'regular') {
<a
[queryParams]="{}"
[routerLinkActiveOptions]="{exact: true}"
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Start]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>Geoportal</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Maps]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>GIS-Browser</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Data]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>Geodatenkatalog</a
>
<a
class="navbar__item"
mat-button
[routerLink]="[mainPageEnum.Support]"
routerLinkActive="navbar__item--active"
ariaCurrentWhenActive="page"
>Hilfe & Support</a
>
<a class="navbar__item" href="https://geodatenshop.zh.ch" mat-button target="_blank" rel="noopener noreferrer">
<mat-icon>launch</mat-icon>
Geodatenshop
</a>
<mat-divider class="navbar__divider" vertical></mat-divider>
@if (!isAuthenticated) {
<button (click)="startLogin()" class="navbar__item navbar__item--button" mat-button>
<mat-icon svgIcon="ktzh_user"></mat-icon>Login
</button>
} @else {
<button [matMenuTriggerFor]="userMenu" class="navbar__item navbar__item--button" mat-button #trigger="matMenuTrigger">
<mat-icon svgIcon="ktzh_user"></mat-icon>
<mat-icon [fontIcon]="trigger.menuOpen ? 'arrow_drop_up' : 'arrow_drop_down'"></mat-icon>
{{ userName }}
<mat-icon [fontIcon]="trigger.menuOpen ? 'arrow_drop_up' : 'arrow_drop_down'" class="navbar__item__arrow-icon"></mat-icon>
</button>

<mat-menu #userMenu="matMenu" style="padding-left: 12px">
<a href="https://maps.zh.ch/groups_users" target="_blank" rel="noopener noreferrer" mat-menu-item>
<mat-icon svgIcon="ktzh_user"></mat-icon>
<span>Profil</span>
</a>
<mat-divider></mat-divider>
<button (click)="logout()" mat-menu-item>
<mat-icon>logout</mat-icon>
<span>Logout</span>
</button>
</mat-menu>
}
} @else {
<button mat-button (click)="showMenu()">
<span class="navbar__menu-text">Menu</span>

<mat-menu #userMenu="matMenu">
<button (click)="this.logout()" mat-menu-item>
<mat-icon>logout</mat-icon>
<span>Logout</span>
</button>
</mat-menu>
<mat-icon svgIcon="ktzh_menu_mobile" iconPositionEnd>launch</mat-icon>
</button>
}

@if (!isSimplifiedPage) {
Expand Down
18 changes: 17 additions & 1 deletion src/app/shared/components/navbar/navbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@
.navbar {
position: relative;
height: 100%;
font-size: 14px;
font-size: 16px;

.navbar__spacer {
flex: 1 1 auto;
}

.navbar__menu-text {
font-family: ktzh-variables.$zh-font-family;
font-size: 16px;
font-weight: 400;
line-height: 24px;
text-align: left;
text-underline-position: from-font;
text-decoration-skip-ink: none;
}

a.navbar__item {
font-family: ktzh-variables.$zh-font-family;

Expand All @@ -30,6 +40,12 @@
font-family: ktzh-variables.$zh-font-family;
}

.navbar__item__arrow-icon {
order: 2;
padding-left: 8px;
margin-right: 0px;
}

.navbar__logo {
height: 52px;
width: 54px;
Expand Down
Loading

0 comments on commit 7f70740

Please sign in to comment.