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> <dialog open>
<h2>Add Task</h2> <h2>Add Task</h2>
<form> <form>
@ -18,7 +18,7 @@
</p> </p>
<p class="actions"> <p class="actions">
<button type="button" (click)="onCloseTask()" >Cancel</button> <button type="button" (click)="onCancel()" >Cancel</button>
<button type="submit">Create</button> <button type="submit">Create</button>
</p> </p>
</form> </form>

View File

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

View File

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

View File

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