diff --git a/src/app/layout/layout-toolbar.component.ts b/src/app/layout/layout-toolbar.component.ts index cd25ec790e..0ba3e474ae 100644 --- a/src/app/layout/layout-toolbar.component.ts +++ b/src/app/layout/layout-toolbar.component.ts @@ -2,9 +2,9 @@ import { ChangeDetectionStrategy, Component, EventEmitter, - Input, Output, inject, + input } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; @@ -43,9 +43,9 @@ import { WebsiteTheme } from './website-theme'; mat-icon-button (click)="toggleMenu()" > - @if (menuOpen) { + @if (menuOpen()) { menu_open - } @if (!(menuOpen)) { + } @if (!(menuOpen())) { menu } @@ -70,7 +70,7 @@ import { WebsiteTheme } from './website-theme'; class="mr-2" (click)="toggleTheme()" > - @if (theme === 'light') { + @if (theme() === 'light') { light_mode } @else { dark_mode @@ -120,10 +120,10 @@ import { WebsiteTheme } from './website-theme'; changeDetection: ChangeDetectionStrategy.OnPush }) export class LayoutToolbarComponent { - @Input() menuOpen: boolean = true; + readonly menuOpen = input(true); @Output() menuOpenChange = new EventEmitter(); - @Input() theme: WebsiteTheme = 'dark'; + readonly theme = input('dark'); @Output() themeChange = new EventEmitter(); @Output() searchKeywordChange = new EventEmitter(); @@ -151,10 +151,10 @@ export class LayoutToolbarComponent { protected suggestList = toSignal(this.suggestList$); protected toggleMenu() { - this.menuOpenChange.emit(!this.menuOpen); + this.menuOpenChange.emit(!this.menuOpen()); } protected toggleTheme() { - this.themeChange.emit(this.theme === 'light' ? 'dark' : 'light'); + this.themeChange.emit(this.theme() === 'light' ? 'dark' : 'light'); } } diff --git a/src/app/site-common/blog-post-subtitle.component.ts b/src/app/site-common/blog-post-subtitle.component.ts index dcc36738c4..84c6b8d374 100644 --- a/src/app/site-common/blog-post-subtitle.component.ts +++ b/src/app/site-common/blog-post-subtitle.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from '@angular/core'; +import { Component, input } from '@angular/core'; import { MatIconModule } from '@angular/material/icon'; import { RouterLink } from '@angular/router'; import { MarkdownMeta } from 'site-utils'; @@ -8,18 +8,18 @@ import { SlugifyPipe } from './slugify.pipe'; @Component({ selector: 'app-blog-post-subtitle', template: ` - @if (postMeta) { + @if (postMeta()) { - @if ((postMeta.categories || []).length > 0) { + @if ((postMeta().categories || []).length > 0) { folder_open - @for (category of postMeta.categories; track category; let last = $last) { + @for (category of postMeta().categories; track category; let last = $last) {