Skip to content

Commit 3308116

Browse files
committed
Version 1.0.0 ok
1 parent ba230ab commit 3308116

File tree

16 files changed

+97
-38
lines changed

16 files changed

+97
-38
lines changed

projects/mugan86-youtube-api/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { Mugan86YoutubeApiModule } from 'mugan86-youtube-api';
2828
...
2929
Mugan86YoutubeApiModule.forRoot({
3030
apiKey: 'API KEY Value
31+
showLog: <Si queremos ver el log del Api Key introducido> (no es obligatorio)
3132
})
3233
],
3334
providers: [],
@@ -56,4 +57,7 @@ Por ejemplo, los videos subidos por **mugan86**, que hace uso de este ID de este
5657
Por ejemplo, los videos subidos por mugan86, que hace uso de este ID de playlist: **'UUTh7-deUJBNv2tHRiMGcXxg'**
5758
```
5859
<mugan86-yt-api-playlist-items [playlistId]="'UUTh7-deUJBNv2tHRiMGcXxg'"></mugan86-yt-api-playlist-items>
59-
```
60+
```
61+
62+
### Librería desarrollada por
63+
* Anartz Mugika ([mugan86](https://github.com/mugan86))
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
{
22
"name": "mugan86-youtube-api",
33
"version": "0.0.1",
4+
"description": "Libreria para usar con la API de Youtube",
45
"peerDependencies": {
56
"@angular/common": "^7.2.0",
67
"@angular/core": "^7.2.0",
78
"@ng-bootstrap/ng-bootstrap": "^4.1.0"
8-
}
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/npm-js-ts-angular-modules-course/proyecto-3-libreria-angular.git"
13+
},
14+
"keywords": [
15+
"youtube api",
16+
"angular youtube api",
17+
"widget",
18+
"playlist"
19+
],
20+
"author": "Anartz Mugika Ledo <mugan86@gmail.com>",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/npm-js-ts-angular-modules-course/proyecto-3-libreria-angular/issues"
24+
},
25+
"homepage": "https://github.com/npm-js-ts-angular-modules-course/proyecto-3-libreria-angular#readme"
926
}

projects/mugan86-youtube-api/src/lib/assets/styles/styles.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ h1 {
2222
height: 100%;
2323
}
2424

25+
.modal-body p {
26+
margin-top: 15px;
27+
}
28+
2529
/** CHANNEL **/
2630

2731
.channel {
@@ -58,4 +62,12 @@ h1 {
5862
.card {
5963
padding: 5px;
6064
margin-bottom: 10px;
65+
}
66+
67+
.morevideos {
68+
position: relative;
69+
left: 41%;
70+
width: 300px;
71+
padding: 10px;
72+
margin: 15px 0px 60px 0px;
6173
}
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<div class="modal-header">
2-
<h4 class="modal-title" id="modal-basic-title">Nuestro video Youtube</h4>
3-
<button type="button" class="close" aria-label="Close" (click)="modalService.dismiss('Cross click')">
4-
<span aria-hidden="true">&times;</span>
5-
</button>
6-
</div>
7-
<div class="modal-body">
8-
<mugan86-yt-api-video-player></mugan86-yt-api-video-player>
9-
</div>
2+
<h4 class="modal-title" id="modal-basic-title">{{ video.title }}</h4>
3+
<button type="button" class="close" aria-label="Close" (click)="modalService.dismiss('Cross click')">
4+
<span aria-hidden="true">&times;</span>
5+
</button>
6+
</div>
7+
<div class="modal-body">
8+
<mugan86-yt-api-video-player [id]="video.id"></mugan86-yt-api-video-player>
9+
<p>{{ video.description | shortDescription:250}}</p>
10+
</div>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Video } from './../../interfaces/video';
12
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
23
import { Component, Input } from '@angular/core';
34

@@ -8,9 +9,7 @@ import { Component, Input } from '@angular/core';
89
})
910
export class ModalVideoComponent {
1011

11-
@Input() title: string;
12-
@Input() body: string;
13-
@Input() videoId: string;
12+
@Input() video: Video;
1413
constructor(public modalService: NgbActiveModal) { }
1514

1615
}

projects/mugan86-youtube-api/src/lib/components/playlist-items/playlist-items.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<img [src]="video.snippet.thumbnails.high.url" class="card-img-top" alt="...">
55
<div class="card-body">
66
<h5 class="card-title">{{ video?.snippet.title }}</h5>
7-
<p class="card-text">{{ video?.snippet.description }}</p>
7+
<p class="card-text">{{ video?.snippet.description | shortDescription:100 }}</p>
88
<p class="card-text"><small class="text-muted">{{ video?.snippet.publishedAt | dateHour}}</small></p>
9+
<button type="button" (click)="showVideo(video)" class="btn btn-info">Ver video</button>
910
</div>
1011
</div>
1112
</ng-template>
1213
</div>
13-
<button (click)="loadMore()">Cargar más videos</button>
14+
<button class="btn btn-outline-info morevideos" (click)="loadMore()">Cargar más videos</button>

projects/mugan86-youtube-api/src/lib/components/playlist-items/playlist-items.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { Video } from './../../interfaces/video';
2+
import { Item } from './../../interfaces/api/playlis-items.interface';
3+
import { ModalService } from './../../services/modal.service';
14
import { ApiService } from './../../services/api.service';
25
import { Component, OnInit, Input } from '@angular/core';
3-
import { Item } from '../../interfaces/api/playlis-items.interface';
46

57
@Component({
68
selector: 'mugan86-yt-api-playlist-items',
@@ -11,7 +13,7 @@ export class PlaylistItemsComponent implements OnInit {
1113
@Input() playlistId: string;
1214
videos: Item[];
1315
noMoreVideos = false;
14-
constructor(private api: ApiService) { }
16+
constructor(private api: ApiService, private modal: ModalService) { }
1517

1618
ngOnInit() {
1719
if (this.playlistId === undefined || this.playlistId === null || this.playlistId === '') {
@@ -39,4 +41,13 @@ export class PlaylistItemsComponent implements OnInit {
3941
this.loadData(true);
4042
}
4143

44+
showVideo(video: Item) {
45+
const videoItem: Video = {
46+
id: video.snippet.resourceId.videoId,
47+
title: video.snippet.title,
48+
description: video.snippet.description
49+
};
50+
this.modal.show(videoItem);
51+
}
52+
4253
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="videoWrapper">
2-
<iframe width="560" height="349" [src]="'qMKo4Az0LwY' | youtube" frameborder="0" allowfullscreen></iframe>
2+
<iframe width="560" height="349" [src]="id | youtube" frameborder="0" allowfullscreen></iframe>
33
</div>
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, Input } from '@angular/core';
22

33
@Component({
44
selector: 'mugan86-yt-api-video-player',
55
templateUrl: './video-player.component.html',
66
styles: []
77
})
8-
export class VideoPlayerComponent implements OnInit {
8+
export class VideoPlayerComponent {
99

10-
constructor() { }
11-
12-
ngOnInit() {
13-
}
10+
@Input() id: string;
1411

1512
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface Video {
2+
id: string;
3+
title: string;
4+
description: string;
5+
}

0 commit comments

Comments
 (0)