From 82e1009231662fa58f450492a97e18d5355c3592 Mon Sep 17 00:00:00 2001 From: imelilabourne Date: Tue, 15 Sep 2020 14:45:52 +0800 Subject: [PATCH] refactored --- db.json | 8 +++++++- .../todo-empty/todo-empty.component.html | 2 +- .../components/todo-empty/todo-empty.component.ts | 15 ++++++++++++++- .../containers/TodoList/todo-list.component.html | 2 +- .../containers/TodoList/todo-list.component.ts | 8 ++++---- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/db.json b/db.json index 1707711..825f3eb 100644 --- a/db.json +++ b/db.json @@ -1,10 +1,16 @@ { "tasks": [ { - "title": "Angular 6", + "title": "Sleep", "completed": false, "editing": false, "id": 1 + }, + { + "title": "Dance", + "completed": false, + "editing": false, + "id": 2 } ] } \ No newline at end of file diff --git a/src/app/Todo-List-App/components/todo-empty/todo-empty.component.html b/src/app/Todo-List-App/components/todo-empty/todo-empty.component.html index 1b77219..08682d1 100644 --- a/src/app/Todo-List-App/components/todo-empty/todo-empty.component.html +++ b/src/app/Todo-List-App/components/todo-empty/todo-empty.component.html @@ -1,4 +1,4 @@ -
+

All Task Accomplished 👻

to-do diff --git a/src/app/Todo-List-App/components/todo-empty/todo-empty.component.ts b/src/app/Todo-List-App/components/todo-empty/todo-empty.component.ts index 66530de..0c90943 100644 --- a/src/app/Todo-List-App/components/todo-empty/todo-empty.component.ts +++ b/src/app/Todo-List-App/components/todo-empty/todo-empty.component.ts @@ -1,9 +1,22 @@ import { Component, OnInit } from '@angular/core'; +import { animate, style, transition, trigger } from '@angular/animations'; @Component({ selector: 'todo-empty', templateUrl: './todo-empty.component.html', - styleUrls: ['./todo-empty.component.css'] + styleUrls: ['./todo-empty.component.css'], + animations: [ + trigger('fade', [ + transition(':enter', [ + style({opacity: 0, transform: 'translateX(-30px)'}), + animate(1200, style({opacity:0, transform: 'translateY(0px)'})) + ]), + transition(':leave', [ + style({opacity: 0, transform: 'translateX(0px)'}), + animate(1000, style({opacity:1, transform: 'translateX(-50px)'})) + ]) + ]) +] }) export class TodoEmptyComponent implements OnInit { diff --git a/src/app/Todo-List-App/containers/TodoList/todo-list.component.html b/src/app/Todo-List-App/containers/TodoList/todo-list.component.html index 65f1541..4370105 100644 --- a/src/app/Todo-List-App/containers/TodoList/todo-list.component.html +++ b/src/app/Todo-List-App/containers/TodoList/todo-list.component.html @@ -43,7 +43,7 @@
{{ remaining()}} uncompleted tasks
- +
You've selected an item
diff --git a/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts b/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts index b9e6773..2200dcc 100644 --- a/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts +++ b/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts @@ -123,10 +123,10 @@ export class TodoList{ clearCompleted(tasks: Tasks){ this.tasks = this.tasks.filter(task => !task.completed); - this.todoService.deleteTask(tasks) - .subscribe(data => this.tasks.filter(task => { - return task == data; - })) + // this.todoService.deleteTask(tasks) + // .subscribe(data => this.tasks.filter(task => { + // return task == data; + // })) } selectAll():void{