Added spinner
This commit is contained in:
@@ -10,6 +10,7 @@ import { MatButtonModule } from '@angular/material/button';
|
|||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatListModule } from '@angular/material/list';
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { MatRadioModule } from '@angular/material/radio';
|
import { MatRadioModule } from '@angular/material/radio';
|
||||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
@@ -29,6 +30,7 @@ const materialModules = [
|
|||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatListModule,
|
MatListModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
MatRadioModule,
|
MatRadioModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
MatToolbarModule
|
MatToolbarModule
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
width: var(--card-width);
|
width: var(--card-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spinner-container {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 190px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.full-width-field {
|
.full-width-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<mat-card class="game-card">
|
<mat-card class="game-card" *ngLet="gameStatus$ | async; let gameStatus;">
|
||||||
<form [formGroup]="form" #gameForm="ngForm" (ngSubmit)="submit($event, gameForm)" novalidate>
|
<form *ngIf="gameStatus === 'pre'" [formGroup]="form" #gameForm="ngForm" (ngSubmit)="submit($event, gameForm)"
|
||||||
|
novalidate>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-radio-group class="full-width-field" formControlName="playerChoice">
|
<mat-radio-group class="full-width-field" formControlName="playerChoice">
|
||||||
<mat-radio-button class="rps-radio-button" *ngFor="let choice of choices" [value]="choice">
|
<mat-radio-button class="rps-radio-button" *ngFor="let choice of choices" [value]="choice">
|
||||||
@@ -13,4 +14,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</form>
|
</form>
|
||||||
|
<div *ngIf="gameStatus === 'pending'" class="spinner-container">
|
||||||
|
<mat-spinner></mat-spinner>
|
||||||
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
@@ -9,6 +9,7 @@ import { GameFacade } from "../store/game";
|
|||||||
styleUrls: ['./game-card.component.css']
|
styleUrls: ['./game-card.component.css']
|
||||||
})
|
})
|
||||||
export class GameCardComponent implements OnInit {
|
export class GameCardComponent implements OnInit {
|
||||||
|
gameStatus$ = this.gameFacade.gameStatus$;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
choices = ['rock', 'paper', 'scissors'];
|
choices = ['rock', 'paper', 'scissors'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user