diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 61dcb3f..92831f8 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -17,6 +17,7 @@ import { AppComponent } from './app.component';
import { TaskFormComponent } from './task-form/task-form.component';
import { TodosListComponent } from './todos-list/todos-list.component';
import { TodoItemComponent } from './todo-item/todo-item.component';
+import { TodoEditComponent } from './todo-edit/todo-edit.component';
@NgModule({
@@ -24,7 +25,8 @@ import { TodoItemComponent } from './todo-item/todo-item.component';
AppComponent,
TaskFormComponent,
TodosListComponent,
- TodoItemComponent
+ TodoItemComponent,
+ TodoEditComponent
],
imports: [
BrowserModule,
diff --git a/src/app/todo-edit/todo-edit.component.css b/src/app/todo-edit/todo-edit.component.css
new file mode 100644
index 0000000..b736363
--- /dev/null
+++ b/src/app/todo-edit/todo-edit.component.css
@@ -0,0 +1,16 @@
+.textDeprecated {
+ color: grey;
+ text-decoration: line-through;
+}
+
+.high {
+ background-color: red;
+}
+
+.medium {
+ background-color: yellow;
+}
+
+.low {
+ background-color: green;
+}
diff --git a/src/app/todo-edit/todo-edit.component.html b/src/app/todo-edit/todo-edit.component.html
new file mode 100644
index 0000000..c88953e
--- /dev/null
+++ b/src/app/todo-edit/todo-edit.component.html
@@ -0,0 +1,15 @@
+
diff --git a/src/app/todo-edit/todo-edit.component.spec.ts b/src/app/todo-edit/todo-edit.component.spec.ts
new file mode 100644
index 0000000..ba0204c
--- /dev/null
+++ b/src/app/todo-edit/todo-edit.component.spec.ts
@@ -0,0 +1,21 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TodoEditComponent } from './todo-edit.component';
+
+describe('TodoEditComponent', () => {
+ let component: TodoEditComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [TodoEditComponent]
+ });
+ fixture = TestBed.createComponent(TodoEditComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/todo-edit/todo-edit.component.ts b/src/app/todo-edit/todo-edit.component.ts
new file mode 100644
index 0000000..c3f78ce
--- /dev/null
+++ b/src/app/todo-edit/todo-edit.component.ts
@@ -0,0 +1,60 @@
+import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {Todo} from "../todo";
+import {FormControl, FormGroup, Validators} from "@angular/forms";
+
+@Component({
+ selector: 'app-todo-edit',
+ templateUrl: './todo-edit.component.html',
+ styleUrls: ['./todo-edit.component.css']
+})
+export class TodoEditComponent implements OnInit {
+ @Output() updateTodoChildEvent = new EventEmitter();
+
+ @Input() todoItemChild!: Todo;
+
+ @Input() isDisabledChild!: true | null;
+ @Input() tasksStatusChild: string = 'low';
+ @Input() isCheckedChild: boolean = false;
+
+ formControlChild = new FormControl('', [Validators.required, Validators.minLength(3)])
+
+ ngOnInit() {
+ this.formControlChild.setValue(this.todoItemChild.name);
+ }
+
+ onChildInputChange(todo: Todo, val: string) {
+ this.updateTodoChildEvent.emit({id: todo.id, name: val});
+ }
+
+ setInputBackground() {
+ switch(this.tasksStatusChild) {
+ case 'high':
+ return 'high';
+ case 'medium':
+ return 'medium';
+ case 'low':
+ return 'low';
+ default:
+ return '';
+ }
+ }
+
+ setInputDecorations() {
+ return this.isCheckedChild ? 'textDeprecated' : '';
+ }
+
+ setClasses() {
+ return {
+ [this.setInputDecorations()]: true,
+ [this.setInputBackground()]: true
+ };
+ }
+
+ getErrorMessage() {
+ if (this.formControlChild.hasError('required')) {
+ return 'You must enter a value';
+ }
+
+ return this.formControlChild.hasError('minlength') ? 'Too short, should be at least 3 symbols' : '';
+ }
+}
diff --git a/src/app/todo-item/todo-item.component.css b/src/app/todo-item/todo-item.component.css
index 0719309..11c6f05 100644
--- a/src/app/todo-item/todo-item.component.css
+++ b/src/app/todo-item/todo-item.component.css
@@ -1,16 +1,7 @@
-.textDepricated {
- color: grey;
- text-decoration: line-through;
+.formContainer {
+ display: flex;
}
-.high {
- background-color: red;
-}
-
-.medium {
- background-color: yellow;
-}
-
-.low {
- background-color: green;
+.wrapper {
+ display: flex;
}
diff --git a/src/app/todo-item/todo-item.component.html b/src/app/todo-item/todo-item.component.html
index 93bd1b7..a9a0f0b 100644
--- a/src/app/todo-item/todo-item.component.html
+++ b/src/app/todo-item/todo-item.component.html
@@ -1,20 +1,14 @@
-
-
-