import { Component, inject<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout'; import { map } from 'rxjs/operators';<% if(standalone) { %> import { AsyncPipe } from '@angular/common'; import { MatGridListModule } from '@angular/material/grid-list'; import { MatMenuModule } from '@angular/material/menu'; import { MatIconModule } from '@angular/material/icon'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card';<% } %> @Component({ selector: '<%= selector %>',<% if(inlineTemplate) { %> template: ` <%= indentTextContent(resolvedFiles.template, 4) %> `,<% } else { %> templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %> styles: ` <%= indentTextContent(resolvedFiles.stylesheet, 4) %> `<% } else { %> styleUrl: './<%= dasherize(name) %>.component.<%= style %>'<% } %><% if(!!viewEncapsulation) { %>, encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>, changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %><% if(standalone) { %>, imports: [ AsyncPipe, MatGridListModule, MatMenuModule, MatIconModule, MatButtonModule, MatCardModule ]<% } else { %>, standalone: false<% } %> }) export class <%= classify(name) %>Component { private breakpointObserver = inject(BreakpointObserver); /** Based on the screen size, switch from standard to one column per row */ cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe( map(({ matches }) => { if (matches) { return [ { title: 'Card 1', cols: 1, rows: 1 }, { title: 'Card 2', cols: 1, rows: 1 }, { title: 'Card 3', cols: 1, rows: 1 }, { title: 'Card 4', cols: 1, rows: 1 } ]; } return [ { title: 'Card 1', cols: 2, rows: 1 }, { title: 'Card 2', cols: 1, rows: 1 }, { title: 'Card 3', cols: 1, rows: 2 }, { title: 'Card 4', cols: 1, rows: 1 } ]; }) ); }