28 lines
728 B
TypeScript
28 lines
728 B
TypeScript
import {Component, Input, OnInit} from '@angular/core';
|
|
import {Router} from "@angular/router";
|
|
import {Header, Item} from "../../../utils/entities/sidebar";
|
|
|
|
@Component({
|
|
selector: 'dashboard-sidebar',
|
|
templateUrl: 'sideBar.component.html'
|
|
})
|
|
export class SideBarComponent implements OnInit {
|
|
@Input() items: Item[] = [];
|
|
@Input() header: Header = null;
|
|
@Input() showHeader: boolean = true;
|
|
@Input() activeItem: string = '';
|
|
@Input() activeSubItem: string = '';
|
|
|
|
constructor(private router: Router) {
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
|
|
isTheActiveMenuItem(item: Item, subItem = false): boolean {
|
|
return (!subItem && this.activeItem === item.id) ||
|
|
(subItem && this.activeSubItem === item.id);
|
|
}
|
|
}
|