diff --git a/src/app/components/add-task/add-task.component.html b/src/app/components/add-task/add-task.component.html index f32c12e..e7fe8e1 100644 --- a/src/app/components/add-task/add-task.component.html +++ b/src/app/components/add-task/add-task.component.html @@ -135,6 +135,28 @@ +
+

Category*

+ +
+ @if (!category.valid && category.touched) { +

You must select a category

+ } +
+
@@ -155,8 +177,10 @@ !taskData.description || date.invalid || !taskData.date || + dateInPast || !taskData.priority || - dateInPast + category.invalid || + !taskData.category " />
diff --git a/src/app/components/add-task/add-task.component.scss b/src/app/components/add-task/add-task.component.scss index ea449b2..3bad938 100644 --- a/src/app/components/add-task/add-task.component.scss +++ b/src/app/components/add-task/add-task.component.scss @@ -11,7 +11,8 @@ section { } input, -textarea { +textarea, +select { font-size: 20px; font-weight: 400; border-radius: 10px; @@ -79,6 +80,7 @@ p { display: flex; justify-content: space-between; gap: 12px; + margin-bottom: 36px; } .btn-text { @@ -91,8 +93,7 @@ p { background-color: var(--white); font-size: 20px; font-weight: 400; - width: 136px; - margin-bottom: 16px; + min-width: 125px; border-radius: 10px; border: 1px solid var(--light-gray); padding: 10px 16px; @@ -112,6 +113,12 @@ p { box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.3); } +.category { + select { + width: 100%; + } +} + /*------------- SUBMIT BUTTON -------------*/ .form-buttons { diff --git a/src/app/components/add-task/add-task.component.ts b/src/app/components/add-task/add-task.component.ts index 586c70a..4ebade8 100644 --- a/src/app/components/add-task/add-task.component.ts +++ b/src/app/components/add-task/add-task.component.ts @@ -12,6 +12,7 @@ import { FormsModule, NgForm, NgModel } from '@angular/forms'; export class AddTaskComponent { @ViewChild('title', { static: true }) titleField!: NgModel; @ViewChild('description', { static: true }) descriptionField!: NgModel; + @ViewChild('category', { static: true }) categoryField!: NgModel; currentDate: string = new Date().toISOString().split('T')[0]; dateInPast: boolean = false; @@ -21,6 +22,7 @@ export class AddTaskComponent { description: '', date: this.currentDate, priority: 'medium', + category: '', }; ngOnInit() { @@ -61,12 +63,14 @@ export class AddTaskComponent { untouchedFormFields() { this.titleField.control.markAsUntouched(); this.descriptionField.control.markAsUntouched(); + this.categoryField.control.markAsUntouched(); } clearFormData() { this.taskData.title = ''; this.taskData.description = ''; this.taskData.date = this.currentDate; + this.taskData.category = ''; } onSubmit(ngForm: NgForm) {