Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #drawer class="sidenav" fixedInViewport
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
[mode]="(isHandset$ | async) ? 'over' : 'side'"
[opened]="(isHandset$ | async) === false">
<mat-toolbar>Menu</mat-toolbar>
[attr.role]="(isHandset()) ? 'dialog' : 'navigation'"
[mode]="(isHandset()) ? 'over' : 'side'"
[opened]="!(isHandset())">
<mat-toolbar>
<span>Menu</span>
</mat-toolbar>
<mat-nav-list>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %>>Link 1</a>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %>>Link 2</a>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %>>Link 3</a>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %> (click)="drawer.close()">Link 1</a>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %> (click)="drawer.close()">Link 2</a>
<a mat-list-item <%= routing ? 'routerLink="/"' : 'href="#"' %> (click)="drawer.close()">Link 3</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary">
@if (isHandset$ | async) {
<mat-toolbar class="mat-elevation-z4">
@if (isHandset()) {
<button
type="button"
aria-label="Toggle sidenav"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component, inject<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { map, shareReplay } from 'rxjs/operators';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';<% if(standalone) { %>
import { AsyncPipe } from '@angular/common';
import { NgIf } from '@angular/common';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatButtonModule } from '@angular/material/button';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatListModule } from '@angular/material/list';
import { MatIconModule } from '@angular/material/icon';<% } %>
import { Observable } from 'rxjs';
import { map, shareReplay } from 'rxjs/operators';

@Component({
selector: '<%= selector %>',<% if(inlineTemplate) { %>
Expand All @@ -27,16 +27,17 @@ import { map, shareReplay } from 'rxjs/operators';
MatSidenavModule,
MatListModule,
MatIconModule,
AsyncPipe,
NgIf,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for an import

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still present

]<% } else { %>,
standalone: false<% } %>
})
export class <%= classify(name) %>Component {
private breakpointObserver = inject(BreakpointObserver);

isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
protected isHandset = toSignal(
this.breakpointObserver.observe(Breakpoints.Handset).pipe(
map(result => result.matches),
shareReplay()
);
),
{ initialValue: false }
);
}
Loading