Added collapse menu

This commit is contained in:
Arne
2023-08-04 11:07:17 +02:00
parent b2fad878fb
commit 34dde43014
4 changed files with 48 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
app-header {
box-shadow: 0 1.5rem 1rem rgba(0,0,0,0.21);
position: relative;
z-index: 5;
z-index: 800;
}
.hero-container {

View File

@@ -6,7 +6,7 @@
</div>
</div>
<div class="menu">
<div class="menu" [ngClass]="{'hidden': !isCollapsed}">
<a href="#diensten">Diensten<span>Diensten</span></a>
<a href="#advies">Advies<span>Advies</span></a>
<a href="#klantworden">Klant worden<span>Klant worden</span></a>
@@ -14,3 +14,6 @@
<a href="#vacatures">Vacatures<span>Vacatures</span></a>
<a href="#contact">Contact<span>Contact</span></a>
</div>
<div class="icon" (click)="isCollapsed = !isCollapsed">
<span class="fa-bars fa-solid"></span>
</div>

View File

@@ -61,10 +61,44 @@
}
@media only screen and (max-width: 1200px) {
:host {
padding: 2rem 3rem;
}
.logo .subtext {
display: none;
}
.menu {
display: none;
flex-direction: column;
align-items: flex-start;
position: absolute;
width: 35%;
right: 0;
top: 11rem;
z-index: 200;
a {
width: 100%;
background-color: $white;
z-index: 200;
}
}
.icon {
margin-left: auto;
margin-right: 0;
height: 7.7rem;
display: flex;
flex-direction: column;
justify-content: center;
span {
color: $primary-color;
font-size: 5rem;
}
}
}
.hidden {
display: none;
}

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, HostListener } from '@angular/core';
@Component({
selector: 'app-header',
@@ -6,5 +6,12 @@ import { Component } from '@angular/core';
styleUrls: ['./header.component.scss']
})
export class HeaderComponent {
public isCollapsed: boolean = false;
@HostListener('document:click', ['$event'])
public reset(event: unknown) {
if (!(event as any).srcElement.classList.contains('fa-bars') && !(event as any).ctrlKey && !(event as any).altKey) {
this.isCollapsed = false;
}
}
}