11import { ChangeDetectionStrategy , Component , inject } from '@angular/core' ;
2- import { MatButton } from '@angular/material/button' ;
2+ import { MatButton , MatIconButton } from '@angular/material/button' ;
33import { MatFormField , MatLabel } from '@angular/material/form-field' ;
44import { MatIcon } from '@angular/material/icon' ;
55import { MatInput } from '@angular/material/input' ;
66import { AuthStore } from '@myorg/auth' ;
7- import { LayoutStore , PageContainer , PageToolbar } from '@myorg/shared' ;
7+ import {
8+ BreakpointStore ,
9+ LayoutStore ,
10+ PageContainer ,
11+ PageToolbar ,
12+ } from '@myorg/shared' ;
813
914import { WeatherForecastStore } from '../../state/weather-forecast.store' ;
1015import { ForecastTable } from '../forecast-table/forecast-table' ;
@@ -13,14 +18,15 @@ import { ForecastTable } from '../forecast-table/forecast-table';
1318 imports : [
1419 PageContainer ,
1520 MatButton ,
21+ MatIconButton ,
1622 MatFormField ,
1723 MatLabel ,
1824 MatInput ,
1925 PageToolbar ,
2026 MatIcon ,
2127 ForecastTable ,
2228 ] ,
23- providers : [ WeatherForecastStore ] ,
29+ providers : [ WeatherForecastStore , BreakpointStore ] ,
2430 selector : 'lib-weather-forecast' ,
2531 template : `
2632 <lib-page-toolbar [title]="layoutStore.title()" />
@@ -45,21 +51,36 @@ import { ForecastTable } from '../forecast-table/forecast-table';
4551 [value]="store.count()"
4652 />
4753 </mat-form-field>
48- <button
49- mat-flat-button
50- class="!px-3 sm:!px-4"
51- color="primary"
52- (click)="
53- store.getForecasts({
54- count: +count.value,
55- plus: authStore.pageRequiresLogin(),
56- })
57- "
58- aria-label="Get Forecasts"
59- >
60- <mat-icon class="sm:!mr-2 !mr-0">refresh</mat-icon>
61- <span class="hidden sm:inline">Get Forecasts</span>
62- </button>
54+ @if (breakpointStore.handset()) {
55+ <button
56+ mat-icon-button
57+ color="primary"
58+ (click)="
59+ store.getForecasts({
60+ count: +count.value,
61+ plus: authStore.pageRequiresLogin(),
62+ })
63+ "
64+ aria-label="Get Forecasts"
65+ >
66+ <mat-icon>refresh</mat-icon>
67+ </button>
68+ } @else {
69+ <button
70+ mat-flat-button
71+ color="primary"
72+ (click)="
73+ store.getForecasts({
74+ count: +count.value,
75+ plus: authStore.pageRequiresLogin(),
76+ })
77+ "
78+ aria-label="Get Forecasts"
79+ >
80+ <mat-icon>refresh</mat-icon>
81+ Get Forecasts
82+ </button>
83+ }
6384 </div>
6485 </div>
6586 <lib-forecast-table
@@ -77,6 +98,7 @@ export class WeatherForecast {
7798 readonly layoutStore = inject ( LayoutStore ) ;
7899 readonly authStore = inject ( AuthStore ) ;
79100 readonly store = inject ( WeatherForecastStore ) ;
101+ readonly breakpointStore = inject ( BreakpointStore ) ;
80102
81103 constructor ( ) {
82104 this . layoutStore . setTitle ( 'Weather Forecasts' ) ;
0 commit comments