Skip to content

Improve jira components, to OnPush strategy #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions frontend/src/app/jira-control/avatar/avatar.component.ts
Original file line number Diff line number Diff line change
@@ -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}')`,
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {}

}
8 changes: 3 additions & 5 deletions frontend/src/app/jira-control/button/button.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,7 +14,4 @@ export class ButtonComponent {
@Input() isWorking: boolean;
@Input() isActive: boolean;
@Input() disabled: boolean;

constructor() {}

}
Original file line number Diff line number Diff line change
@@ -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() {}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/jira-control/svg-icon/svg-icon.component.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<div class="sidebar-content">
<div class="flex px-1 py-6">
<j-avatar avatarUrl="https://res.cloudinary.com/dvujyxh7e/image/upload/c_scale,w_256/v1593097745/angular-vietnam-transparent_iwfwxa.png"
[name]="'Project'"
[rounded]="false"
[size]="45"
title="Angular Vietnam">
Expand Down Expand Up @@ -49,4 +48,4 @@
class="divider"></div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h3 class="m-10 text-center">
<a class="text-lg text-blue-500 hover:text-blue-800"
href="https://jira.trungk18.com/">Visit the work in progress app</a> |
<a class="text-lg text-blue-500 hover:text-blue-800"
href="hhttps://github.com/trungk18/jira-clone-angular/tree/master/frontend">View front-end code</a>
href="https://github.com/trungk18/jira-clone-angular/tree/master/frontend">View front-end code</a>
</h3>

<div class="px-4 py-3 text-teal-900 bg-teal-100 border-t-4 border-teal-500 rounded-b shadow-md"
Expand Down Expand Up @@ -38,4 +38,4 @@ <h3 class="m-10 text-center">
</p>
<div>© 2020 <a class="text-blue-500 hover:text-blue-800"
href="https://trungk18.com/">Trung Vo</a></div>
</div>
</div>