|
1 | | -import { Component, HostBinding, Input, OnInit } from '@angular/core'; |
| 1 | +import { Component, computed, input } from '@angular/core'; |
2 | 2 | import { NgClass } from '@angular/common'; |
3 | | -import { RouterLink } from '@angular/router'; |
| 3 | +import { RouterLink, type UrlTree } from '@angular/router'; |
4 | 4 |
|
5 | 5 | import { HtmlAttributesDirective } from '../../shared'; |
6 | 6 |
|
7 | 7 | @Component({ |
8 | | - selector: 'c-sidebar-brand', |
9 | | - templateUrl: './sidebar-brand.component.html', |
10 | | - imports: [RouterLink, HtmlAttributesDirective, NgClass] |
| 8 | + selector: 'c-sidebar-brand', |
| 9 | + templateUrl: './sidebar-brand.component.html', |
| 10 | + imports: [RouterLink, HtmlAttributesDirective, NgClass], |
| 11 | + host: { class: 'sidebar-brand' } |
11 | 12 | }) |
12 | | -export class SidebarBrandComponent implements OnInit { |
| 13 | +export class SidebarBrandComponent { |
| 14 | + readonly brandFull = input<any>(); |
| 15 | + readonly brandNarrow = input<any>(); |
13 | 16 |
|
14 | | - @Input() brandFull?: any; |
15 | | - @Input() brandNarrow?: any; |
16 | | - @Input() routerLink?: any[] | string; |
| 17 | + readonly routerLink = input<string | any[] | UrlTree | null | undefined>(); |
17 | 18 |
|
18 | | - @HostBinding('class.sidebar-brand') sidebarBrandClass = true; |
19 | | - |
20 | | - brandImg = false; |
21 | | - |
22 | | - ngOnInit(): void { |
23 | | - this.brandImg = Boolean(this.brandFull || this.brandNarrow); |
24 | | - } |
| 19 | + readonly brandImg = computed(() => Boolean(this.brandFull() || this.brandNarrow())); |
25 | 20 | } |
0 commit comments