-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Sevilleja
committed
Nov 6, 2017
1 parent
f3a2021
commit 21c4f00
Showing
2 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,57 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { GifService } from '@app/core/services/gif.service'; | ||
|
||
@Component({ | ||
selector: 'app-battle', | ||
template: ` | ||
<p> | ||
battle works! | ||
</p> | ||
<h1 class="title has-text-centered">Battle!</h1> | ||
<div class="columns" *ngIf="battleGifs"> | ||
<div class="column is-half" *ngFor="let gif of battleGifs"> | ||
<div class="gif-container"> | ||
<img [src]="gif.url"> | ||
<div class="caption">{{ gif.caption }}</div> | ||
</div> | ||
</div> | ||
</div> | ||
`, | ||
styles: [] | ||
styles: [` | ||
.gif-container { | ||
position: relative; | ||
} | ||
.caption { | ||
display: block; | ||
position: absolute; | ||
left: 20px; | ||
right: 20px; | ||
bottom: 30px; | ||
text-align: center; | ||
color: #FFF; | ||
font-size: 30px; | ||
text-transform: uppercase; | ||
line-height: 1; | ||
word-break: break-all; | ||
text-shadow: 1px 1px 3px #000; | ||
} | ||
img { | ||
width: 100%; | ||
height: 300px; | ||
border-radius: 3px; | ||
} | ||
`] | ||
}) | ||
export class BattleComponent implements OnInit { | ||
battleGifs: Array<any>; | ||
|
||
constructor() { } | ||
constructor(private gifService: GifService) {} | ||
|
||
ngOnInit() { | ||
this.gifService.getBattle() | ||
.subscribe(gifs => this.battleGifs = gifs); | ||
} | ||
|
||
} |