diff --git a/frontend/src/app/jira-control/avatar/avatar.component.ts b/frontend/src/app/jira-control/avatar/avatar.component.ts index a7fce56c..a6adcfe5 100644 --- a/frontend/src/app/jira-control/avatar/avatar.component.ts +++ b/frontend/src/app/jira-control/avatar/avatar.component.ts @@ -1,19 +1,25 @@ -import { Component, Input } from '@angular/core'; +import {ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges} from '@angular/core'; @Component({ selector: 'j-avatar', templateUrl: './avatar.component.html', - styleUrls: ['./avatar.component.scss'] + styleUrls: ['./avatar.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) -export class AvatarComponent { +export class AvatarComponent implements OnChanges { @Input() avatarUrl: string; @Input() size = 12; - @Input() name = ''; @Input() rounded = true; @Input() className = ''; - get style() { - return { + public style: any; + + ngOnChanges(changes: SimpleChanges) { + this.updateStyle(); + } + + private updateStyle() { + this.style = { width: `${this.size}px`, height: `${this.size}px`, 'background-image': `url('${this.avatarUrl}')`, diff --git a/frontend/src/app/jira-control/breadcrumbs/breadcrumbs.component.ts b/frontend/src/app/jira-control/breadcrumbs/breadcrumbs.component.ts index a50d7251..bbf1a8c6 100644 --- a/frontend/src/app/jira-control/breadcrumbs/breadcrumbs.component.ts +++ b/frontend/src/app/jira-control/breadcrumbs/breadcrumbs.component.ts @@ -1,12 +1,11 @@ -import { Component, Input } from '@angular/core'; +import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; @Component({ selector: 'breadcrumbs', templateUrl: './breadcrumbs.component.html', - styleUrls: ['./breadcrumbs.component.scss'] + styleUrls: ['./breadcrumbs.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class BreadcrumbsComponent { @Input() items: string[] = []; - constructor() {} - } diff --git a/frontend/src/app/jira-control/button/button.component.ts b/frontend/src/app/jira-control/button/button.component.ts index 20997470..48cdeb29 100644 --- a/frontend/src/app/jira-control/button/button.component.ts +++ b/frontend/src/app/jira-control/button/button.component.ts @@ -1,9 +1,10 @@ -import { Component, Input } from '@angular/core'; +import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; @Component({ selector: 'j-button', templateUrl: './button.component.html', - styleUrls: ['./button.component.scss'] + styleUrls: ['./button.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class ButtonComponent { @Input() type = 'button'; @@ -13,7 +14,4 @@ export class ButtonComponent { @Input() isWorking: boolean; @Input() isActive: boolean; @Input() disabled: boolean; - - constructor() {} - } diff --git a/frontend/src/app/jira-control/svg-definitions/svg-definitions.component.ts b/frontend/src/app/jira-control/svg-definitions/svg-definitions.component.ts index 41960c65..16c6c2d0 100644 --- a/frontend/src/app/jira-control/svg-definitions/svg-definitions.component.ts +++ b/frontend/src/app/jira-control/svg-definitions/svg-definitions.component.ts @@ -1,8 +1,9 @@ -import { Component } from '@angular/core'; +import {ChangeDetectionStrategy, Component} from '@angular/core'; @Component({ selector: 'svg-definitions', - templateUrl: './svg-definitions.component.html' + templateUrl: './svg-definitions.component.html', + changeDetection: ChangeDetectionStrategy.OnPush }) export class SvgDefinitionsComponent { constructor() {} diff --git a/frontend/src/app/jira-control/svg-icon/svg-icon.component.ts b/frontend/src/app/jira-control/svg-icon/svg-icon.component.ts index 1e520669..238d000e 100644 --- a/frontend/src/app/jira-control/svg-icon/svg-icon.component.ts +++ b/frontend/src/app/jira-control/svg-icon/svg-icon.component.ts @@ -1,8 +1,9 @@ -import { Component, Input } from '@angular/core'; +import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; @Component({ selector: 'svg-icon', - templateUrl: './svg-icon.component.html' + templateUrl: './svg-icon.component.html', + changeDetection: ChangeDetectionStrategy.OnPush }) export class SvgIconComponent { @Input() name: string; diff --git a/frontend/src/app/project/components/navigation/sidebar/sidebar.component.html b/frontend/src/app/project/components/navigation/sidebar/sidebar.component.html index fd23ee17..bc92ee2c 100644 --- a/frontend/src/app/project/components/navigation/sidebar/sidebar.component.html +++ b/frontend/src/app/project/components/navigation/sidebar/sidebar.component.html @@ -3,7 +3,6 @@ - \ No newline at end of file + diff --git a/frontend/src/app/work-in-progress/work-in-progress.component.html b/frontend/src/app/work-in-progress/work-in-progress.component.html index 3470f3b5..8e1ec84d 100644 --- a/frontend/src/app/work-in-progress/work-in-progress.component.html +++ b/frontend/src/app/work-in-progress/work-in-progress.component.html @@ -8,7 +8,7 @@

Visit the work in progress app | View front-end code + href="https://github.com/trungk18/jira-clone-angular/tree/master/frontend">View front-end code

© 2020 Trung Vo
-
\ No newline at end of file +