Skip to content

Commit

Permalink
5th-Major-commit: passing data b/w components & UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SidP919 committed Dec 21, 2021
1 parent 273fb3f commit 1e21899
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Angular/to_do_list/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<header>
<!-- Fixed Navbar -->
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary d-block text-center">
<a class="navbar-brand" href="#">
&nbsp;<img src="./assets/images/todo_list_icon.png" width="30" height="30"
class="d-inline-block align-top bg-white rounded" alt="ToDoList icon">
Expand Down
4 changes: 3 additions & 1 deletion Angular/to_do_list/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ToDoListComponent } from './subComponents/to-do-list/to-do-list.component';
import { ToDoItemComponent } from './subComponents/to-do-item/to-do-item.component';

@NgModule({
declarations: [
AppComponent,
ToDoListComponent
ToDoListComponent,
ToDoItemComponent
],
imports: [
BrowserModule,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="border border-white border-3 bg-primary rounded-3 p-1 m-1">
<h4 class="d-inline-block form-control-sm">{{toDoItem.srNo}}-&nbsp;<u>{{toDoItem.title}}</u></h4>
<p class="form-control-sm">{{toDoItem.desc.substring(0,64)}}...</p>
<div class="container mb-1">
<div class="row">
<img src="./../../../assets/images/tick_symbol.png" class="col-lg-3 col-md-4 col-sm-5 col-xs-5 col-5 mx-auto d-inline-block" alt="Completed" />
<img src="./../../../assets/images/delete-item-icon-png.png" class="col-lg-3 col-md-4 col-sm-5 col-xs-5 col-5 mx-auto d-inline-block" alt="Delete" />
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ToDoItemComponent } from './to-do-item.component';

describe('ToDoItemComponent', () => {
let component: ToDoItemComponent;
let fixture: ComponentFixture<ToDoItemComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ToDoItemComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ToDoItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, Input, OnInit } from '@angular/core';
import { Todo } from 'src/app/models/Todo';

@Component({
selector: 'app-to-do-item',
templateUrl: './to-do-item.component.html',
styleUrls: ['./to-do-item.component.css']
})
export class ToDoItemComponent implements OnInit {
@Input()
toDoItem: Todo = new Todo;
constructor() { }

ngOnInit(): void {
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<ul *ngFor="let todo of todosArr">
<li class="list-unstyled bg-danger d-inline p-2">
{{todo.srNo}} - {{todo.title}} - {{todo.desc}} - {{todo.active}}
</li>
</ul>
<div class="container">
<div class="row">
<div *ngFor="let todo of todosArr" class="col-lg-3 col-md-4 col-sm-4 col-6">
<app-to-do-item [toDoItem] = "todo"></app-to-do-item>
</div>
</div>
</div>
<br>
<br>
<br>
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ export class ToDoListComponent implements OnInit {
{
srNo: 1,
title: "First title",
desc: "description of first todo",
desc: "description of first todo: Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus harum repellendus cupiditate commodi?",
active: true
},
{
srNo: 2,
title: "Second title",
desc: "description of second todo",
desc: "description of second todo: Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus harum repellendus cupiditate commodi?",
active: true
},
{
srNo: 3,
title: "Third title",
desc: "description of third todo",
desc: "description of third todo: Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus harum repellendus cupiditate commodi?",
active: true
},
{
srNo: 4,
title: "Fourth title",
desc: "description of fourth todo",
desc: "description of fourth todo: Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus harum repellendus cupiditate commodi?",
active: true
},
{
srNo: 5,
title: "Fifth title",
desc: "description of fifth todo",
desc: "description of fifth todo: Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus harum repellendus cupiditate commodi?",
active: true
}
]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e21899

Please sign in to comment.