From 9d4fe14b3b46f5f65ccd96f285a932a98f0f14c7 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Sun, 24 Mar 2024 08:30:57 +0100 Subject: [PATCH] added mobile sidebar --- src/app/app.component.scss | 1 - .../sidebar-mobile.component.html | 54 ++++++++++++++++++- .../sidebar-mobile.component.scss | 37 +++++++++++++ .../sidebar-mobile.component.ts | 20 ++++++- 4 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/app/app.component.scss b/src/app/app.component.scss index d05a0ea..61a030a 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -15,7 +15,6 @@ app-sidebar-mobile { bottom: 0; width: 100%; height: 80px; - background-color: var(--bgSidebar); } main { diff --git a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.html b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.html index c90b687..73afa1b 100644 --- a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.html +++ b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.html @@ -1 +1,53 @@ -

sidebar-mobile works!

+
+ +
diff --git a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.scss b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.scss index e69de29..7a26591 100644 --- a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.scss +++ b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.scss @@ -0,0 +1,37 @@ +nav { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + justify-content: space-evenly; + align-items: center; + height: 80px; + background-color: var(--bgSidebar); +} + +.nav-links { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 80px; + height: 65px; + cursor: pointer; + &:hover { + background-color: var(--very-dark-blue); + border-radius: 8px; + } + p { + color: var(--light-gray); + font-size: 14px; + font-style: normal; + font-weight: 400; + margin: 0; + padding: 8px 0 0 0; + } +} + +.active { + background-color: var(--very-dark-blue); +} diff --git a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.ts b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.ts index 83553b2..2effd64 100644 --- a/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.ts +++ b/src/app/shared/components/sidebar/sidebar-mobile/sidebar-mobile.component.ts @@ -1,12 +1,28 @@ +import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; +import { NavigationEnd, Router, RouterModule } from '@angular/router'; @Component({ selector: 'app-sidebar-mobile', standalone: true, - imports: [], + imports: [RouterModule, CommonModule], templateUrl: './sidebar-mobile.component.html', - styleUrl: './sidebar-mobile.component.scss' + styleUrl: './sidebar-mobile.component.scss', }) export class SidebarMobileComponent { + currentPath: string = ''; + constructor(private router: Router) {} + + ngOnInit(): void { + this.getCurrentPath(); + } + + getCurrentPath() { + this.router.events.subscribe((event) => { + if (event instanceof NavigationEnd) { + this.currentPath = this.router.url.substring(1); + } + }); + } }