Updating naming functions and variables. Adding onCancel call when click on the background.
All checks were successful
Deploying Website / build (push) Successful in 1m2s

This commit is contained in:
Maxime Delporte 2025-04-21 21:44:20 -03:00
parent 234403c4c9
commit f91561db26
4 changed files with 12 additions and 13 deletions

View File

@ -1,4 +1,4 @@
<div class="backdrop"></div>
<div class="backdrop" (click)="onCancel()"></div>
<dialog open>
<h2>Add Task</h2>
<form>
@ -18,7 +18,7 @@
</p>
<p class="actions">
<button type="button" (click)="onCloseTask()" >Cancel</button>
<button type="button" (click)="onCancel()" >Cancel</button>
<button type="submit">Create</button>
</p>
</form>

View File

@ -1,5 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Task} from '../../task/task.model';
import {Component, EventEmitter, Output} from '@angular/core';
@Component({
selector: 'app-new-task',
@ -8,9 +7,9 @@ import {Task} from '../../task/task.model';
styleUrl: './new-task.component.css'
})
export class NewTaskComponent {
@Output() close = new EventEmitter<null>();
@Output() cancel = new EventEmitter<void>();
onCloseTask() {
this.close.emit();
onCancel() {
this.cancel.emit();
}
}

View File

@ -1,5 +1,5 @@
@if (isAddingTask) {
<app-new-task (close)="onStopAddTask()" />
<app-new-task (cancel)="onCancelAddTask()" />
}
<section id="tasks">

View File

@ -43,15 +43,15 @@ export class TasksComponent {
return this.tasks.filter((task) => task.userId === this.user.id);
}
onCompleteTask(taskId: string) {
this.tasks = this.tasks.filter((task) => task.id !== taskId);
}
onStartAddTask() {
this.isAddingTask = true;
}
onStopAddTask() {
onCancelAddTask() {
this.isAddingTask = false;
}
onCompleteTask(taskId: string) {
this.tasks = this.tasks.filter((task) => task.id !== taskId);
}
}