From 25481335587a86ca940108a674f40894f303c46e Mon Sep 17 00:00:00 2001 From: Igor Propisnov Date: Wed, 17 Jul 2024 13:54:15 +0200 Subject: [PATCH] added ui/ux logic for side menu --- .../dashboard-root.component.html | 134 +++++++++++++----- .../dashboard-root.component.ts | 24 ++-- 2 files changed, 110 insertions(+), 48 deletions(-) diff --git a/frontend/src/app/pages/dashboard-root/dashboard-root.component.html b/frontend/src/app/pages/dashboard-root/dashboard-root.component.html index f25241c..23eb2c3 100644 --- a/frontend/src/app/pages/dashboard-root/dashboard-root.component.html +++ b/frontend/src/app/pages/dashboard-root/dashboard-root.component.html @@ -1,41 +1,97 @@ -
- -
-
Logo
-
    -
  • - - {{ item.icon }} - - - {{ item.name }} - -
      -
    • - {{ subItem }} -
    • -
    -
  • -
-
- - +
+ +
+
+ +
+
+
Logo
+
+ + +
- -
Hauptinhalt hier
+
+ +
+
    +
  • + + +
    +
    + + {{ item.name }} +
    + + â–ļ + +
    + +
      +
    • + {{ subItem }} +
    • +
    +
  • +
+
+ +
+ + +
Hauptinhalt hier
+
diff --git a/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts b/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts index abcc404..aec9cfb 100644 --- a/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts +++ b/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts @@ -4,10 +4,11 @@ import { Component, HostListener, } from '@angular/core'; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; interface MenuItem { name: string; - icon: string; + icon: SafeHtml; subItems: string[]; open?: boolean; } @@ -23,21 +24,21 @@ interface MenuItem { }) export class DashboardRootComponent { public isCollapsed: boolean = false; + public isDesktopCollapsed: boolean = false; public showMobileMenu: boolean = false; public userHasInteracted: boolean = false; public menuItems: MenuItem[] = [ - { name: 'Home', icon: '🏠', subItems: [] }, - { name: 'About', icon: 'ℹī¸', subItems: [] }, { - name: 'Services', - icon: '🛠ī¸', - subItems: ['Web Design', 'SEO', 'Development'], - open: false, + name: 'Dashboard', + icon: this.sanitizer + .bypassSecurityTrustHtml(` + + `), + subItems: [], }, - { name: 'Contact', icon: '📞', subItems: [] }, ]; - public constructor() {} + public constructor(private sanitizer: DomSanitizer) {} @HostListener('window:resize', ['$event']) public onResize(): void { @@ -53,9 +54,14 @@ export class DashboardRootComponent { public toggleSidebar(): void { this.isCollapsed = !this.isCollapsed; + this.showMobileMenu = !this.isCollapsed; this.userHasInteracted = true; } + public toggleDesktopSidebar(): void { + this.isDesktopCollapsed = !this.isDesktopCollapsed; + } + public toggleSubMenu(item: any): void { if (item.subItems.length) { item.open = !item.open;