-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load images from firebase + animation
- Loading branch information
Showing
20 changed files
with
95 additions
and
42 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
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,4 @@ | ||
export interface Images{ | ||
name: string; | ||
images: string[]; | ||
} |
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,26 +1,14 @@ | ||
<div class="panel-holder"> | ||
<div class="photos-holder"> | ||
<div class="more-photos-info"> | ||
<h1>More photos</h1> | ||
<div (click)="goToGallery()" class="more-photos-info"> | ||
<h1>Click to see more photos</h1> | ||
</div> | ||
<div class="mover"> | ||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
|
||
<img class="photo" src="assets/images/show1-min.jpg"> | ||
<img *ngFor="let image of images; let i = index" | ||
[ngClass]="i == 0 ? 'first': 'second'" | ||
(load)="setVisibilityOfImage(i)" | ||
[@fadeImage]="visibilityOfPhoto[i] == null? defaultStateVisibility: visibilityOfPhoto[i]" | ||
[attr.src]="image | async"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="tech-slideshow"> | ||
<div class="mover-1"></div> | ||
</div> |
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,16 +1,62 @@ | ||
import {Component, OnInit} from '@angular/core'; | ||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
import { AngularFireStorage } from '@angular/fire/storage'; | ||
import { AngularFirestore } from '@angular/fire/firestore'; | ||
import { Observable } from 'rxjs'; | ||
import { Images } from 'src/app/data/images'; | ||
import { trigger, state, style, transition, animate } from '@angular/animations'; | ||
|
||
enum PhotoState { | ||
Loading = 'Loading', | ||
Downloaded = 'Downloaded' | ||
} | ||
|
||
@Component({ | ||
selector: 'app-photo-panel', | ||
templateUrl: './photo-panel.component.html', | ||
styleUrls: ['./photo-panel.component.scss'] | ||
styleUrls: ['./photo-panel.component.scss'], | ||
animations: [trigger('fadeImage', [ | ||
state(PhotoState.Loading, style({ opacity: 0 })), | ||
state(PhotoState.Downloaded, style({ opacity: 1 })), | ||
transition('* <=> *', animate(500)) | ||
])] | ||
}) | ||
export class PhotoPanelComponent implements OnInit { | ||
|
||
constructor() { | ||
images: Observable<string>[]; | ||
imagesColRef: Observable<Images[]>; | ||
visibilityOfPhoto: PhotoState[]; | ||
defaultStateVisibility: PhotoState.Loading; | ||
|
||
constructor(private afStorage: AngularFireStorage, private afStore: AngularFirestore) { | ||
|
||
} | ||
|
||
ngOnInit() { | ||
this.loadImages(); | ||
} | ||
|
||
loadImages() { | ||
this.imagesColRef = this.afStore | ||
.collection<Images>('images', ref => ref.where('name', '==', 'past-images').limit(1)) | ||
.valueChanges(); | ||
this.imagesColRef.subscribe((data) => { | ||
this.images = null; | ||
this.visibilityOfPhoto = []; | ||
if (data.length > 0 && data != null) { | ||
const rightCol = data[0]; | ||
this.images = rightCol.images.map((imagePath) => this.afStorage.ref(imagePath).getDownloadURL()); | ||
this.visibilityOfPhoto.push(PhotoState.Loading); | ||
} | ||
}); | ||
} | ||
|
||
|
||
setVisibilityOfImage(index) { | ||
this.visibilityOfPhoto[index] = PhotoState.Downloaded; | ||
} | ||
|
||
goToGallery(){ | ||
window.open('https://photos.app.goo.gl/HZVpzAtDejCNnqUXA', '_blank'); | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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