refactor: improve code structure and add change detection
This commit is contained in:
parent
5c34014841
commit
eede85295e
5 changed files with 41 additions and 11 deletions
|
@ -1,4 +1,11 @@
|
|||
import { Component, Input, Output, EventEmitter, ElementRef } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
ElementRef,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AnimationService } from '../../../services/animation.service';
|
||||
|
||||
|
@ -21,6 +28,7 @@ import { AnimationService } from '../../../services/animation.service';
|
|||
</button>
|
||||
`,
|
||||
styles: [],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AnimatedButtonComponent {
|
||||
@Input() variant: 'primary' | 'secondary' = 'primary';
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
import { Component, Input, Output, EventEmitter, ElementRef } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
ElementRef,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Game } from '../../../services/game.service';
|
||||
import { AnimatedButtonComponent } from '../animated-button/animated-button.component';
|
||||
|
@ -79,6 +86,7 @@ import { AnimationService } from '../../../services/animation.service';
|
|||
</div>
|
||||
`,
|
||||
styles: [],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class GameCardComponent {
|
||||
@Input() game!: Game;
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
import { Component, Input, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
ViewChild,
|
||||
ElementRef,
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { default as autoAnimate } from '@formkit/auto-animate';
|
||||
import { Winner } from '../../../services/winner.service';
|
||||
|
@ -21,6 +28,7 @@ import { Winner } from '../../../services/winner.service';
|
|||
</div>
|
||||
`,
|
||||
styles: [],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class WinnerTickerComponent implements AfterViewInit {
|
||||
@Input() winners: Winner[] = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue