Fix the mobile menu
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details

pull/9/head
Colin FRIZOT 12 months ago
parent 576718de19
commit 7894d9be41

@ -1,4 +1,10 @@
<div class="header" role="banner" [ngClass]="themeClass">
<div
class="overlay"
[ngClass]="{visible: isMenuOpen }"
(click)="openCloseMenu()"
></div>
<div class="left_part">
<div class="left_part__logo--container">
<a routerLink="/" routerLinkActive="active">

@ -54,6 +54,21 @@ $theme-transition: all 0.3s ease-in-out;
justify-content: space-between;
gap: 2rem;
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(black, .2);
display: none;
&.visible {
display: block;
z-index: 1;
}
}
.left_part {
display: flex;
flex-direction: row;

@ -54,14 +54,13 @@ export class HeaderComponent {
openCloseMenu() {
this.isMenuOpen = !this.isMenuOpen;
}
@HostListener('document:click', ['$event'])
clickout(event: MouseEvent) {
event.stopPropagation();
// If the menu is open and click is outside the menu, we close it
if (this.isMenuOpen && !this.menuRef.nativeElement.contains(event.target)) {
this.isMenuOpen = false;
if(this.isMenuOpen) {
// Add an overflow to the body
document.body.classList.add('no-scroll')
} else {
// Remove the overflow of the body
document.body.classList.remove('no-scroll')
}
}
}

@ -12,4 +12,8 @@ $color-gray: #64748b;
body {
margin: 0;
&.no-scroll {
overflow: hidden;
}
}

Loading…
Cancel
Save