-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial implementation update project version
- Loading branch information
Showing
8 changed files
with
104 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "megaman2", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/app/components/password-board/password-board.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
table { | ||
border-collapse: collapse; | ||
} | ||
|
||
td { | ||
border: 1px solid black; | ||
} | ||
|
||
.hide { | ||
border: none; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/app/components/password-board/password-board.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<table> | ||
<tr> | ||
<td class="hide"></td> | ||
<th>1</th> | ||
<th>2</th> | ||
<th>3</th> | ||
<th>4</th> | ||
<th>5</th> | ||
</tr> | ||
<tr *ngFor="let row of rows"> | ||
<th>{{ row[0] }}</th> | ||
<td>{{ row[1] }}</td> | ||
<td>{{ row[2] }}</td> | ||
<td>{{ row[3] }}</td> | ||
<td>{{ row[4] }}</td> | ||
<td>{{ row[5] }}</td> | ||
</tr> | ||
</table> |
25 changes: 25 additions & 0 deletions
25
src/app/components/password-board/password-board.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PasswordBoardComponent } from './password-board.component'; | ||
|
||
describe('PasswordBoardComponent', () => { | ||
let component: PasswordBoardComponent; | ||
let fixture: ComponentFixture<PasswordBoardComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ PasswordBoardComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(PasswordBoardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
src/app/components/password-board/password-board.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Coordinate as xy } from 'src/app/models/coordinate.model'; | ||
|
||
@Component({ | ||
selector: 'mm2-password-board', | ||
templateUrl: './password-board.component.html', | ||
styleUrls: ['./password-board.component.css'] | ||
}) | ||
export class PasswordBoardComponent { | ||
|
||
@Input() | ||
data: Array<xy> = []; | ||
|
||
get rows(): any { | ||
const rows = []; | ||
for (let x of this.rowHeader) { | ||
const newRow = [x]; | ||
for (let y of this.colHeader) { | ||
const marker = this.getMarker(x, y); | ||
newRow.push(marker); | ||
} | ||
rows.push(newRow); | ||
} | ||
return rows; | ||
} | ||
|
||
// LOWER LEVEL IMPLEMENTATION DETAILS | ||
|
||
private getMarker(x: string, y: string): string { | ||
const target = `${x}${y}`; | ||
const wasFound = this.data.find(candidate => candidate.xy === target); | ||
return wasFound ? '*' : ''; | ||
} | ||
|
||
private get colHeader(): Array<string> { | ||
return ['1', '2', '3', '4', '5']; | ||
} | ||
|
||
private get rowHeader(): Array<string> { | ||
return ['A', 'B', 'C', 'D', 'E']; | ||
} | ||
|
||
} |