Skip to content

Commit

Permalink
feat(app): bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed May 23, 2023
1 parent 1c32898 commit ba04b2d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@angular/cli": "~16.0.2",
"@angular/compiler-cli": "^16.0.0",
"@angular/language-service": "~16.0.0",
"@compodoc/compodoc": "1.1.19",
"@compodoc/compodoc": "1.1.20",
"@types/node": "~20.2.1",
"ts-node": "~10.9.1",
"tslint": "~6.1.3",
Expand Down
4 changes: 3 additions & 1 deletion src/app/about/about.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit, HostListener } from '@angular/core';

import { EmptyService } from '../shared/services/empty.service';
import { DoNothingDirective } from '../shared/directives/do-nothing.directive';

/**
* The about component
Expand All @@ -10,7 +11,8 @@ import { EmptyService } from '../shared/services/empty.service';
@Component({
selector: 'about',
templateUrl: './about.component.html',
providers: [EmptyService]
providers: [EmptyService],
hostDirectives: [DoNothingDirective],
})
export class AboutComponent implements OnInit {
ngOnInit() {}
Expand Down
5 changes: 4 additions & 1 deletion src/app/list/todo/todo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export class TodoComponent {
/**
* The entry todo from the parent list
*/
@Input()
@Input({
required: true,
alias: 'todo',
})
todo: Todo;

/**
Expand Down
27 changes: 27 additions & 0 deletions src/app/shared/directives/border.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Directive, ElementRef, HostListener, Input, OnInit } from '@angular/core';

@Directive({
selector: '[appBorder]',
standalone: true,
})
export class BorderDirective implements OnInit {
@Input() color: string = 'red';

constructor(private el: ElementRef) {}

ngOnInit() {
this.border('');
}

@HostListener('mouseenter') onMouseEnter() {
this.border(this.color);
}

@HostListener('mouseleave') onMouseLeave() {
this.border('');
}

private border(color: string) {
this.el.nativeElement.style.border = `2px solid ${color || 'transparent'}`;
}
}
4 changes: 3 additions & 1 deletion src/app/shared/directives/do-nothing.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Directive, HostBinding, HostListener, Input } from '@angular/core';
import { Directive, HostBinding, HostListener } from '@angular/core';
import { BorderDirective } from './border.directive';

/**
* This directive does nothing !
*/
@Directive({
selector: '[donothing]',
standalone: true,
hostDirectives: [BorderDirective],
})
export class DoNothingDirective {
protected popover: string;
Expand Down
20 changes: 20 additions & 0 deletions src/app/shared/directives/highlight-and-border.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Directive } from '@angular/core';
import { BorderDirective } from './border.directive';
import { HighlightDirective } from './highlight.directive';

@Directive({
selector: '[appHighlightAndBorder]',
hostDirectives: [
{
directive: HighlightDirective,
inputs: ['color'],
},
{
directive: BorderDirective,
inputs: ['color'],
outputs: ['tat', 'tit'],
},
],
standalone: true,
})
export class HighlightAndBorderDirective {}
23 changes: 23 additions & 0 deletions src/app/shared/directives/highlight.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Directive, ElementRef, HostListener, Input } from '@angular/core';

@Directive({
selector: '[appHighlight]',
standalone: true,
})
export class HighlightDirective {
@Input() color = 'yellow';

constructor(private el: ElementRef) {}

@HostListener('mouseenter') onMouseEnter() {
this.highlight(this.color);
}

@HostListener('mouseleave') onMouseLeave() {
this.highlight('');
}

private highlight(color: string) {
this.el.nativeElement.style.backgroundColor = color;
}
}

0 comments on commit ba04b2d

Please sign in to comment.