diff --git a/src/app/gallery/album/album.component.css b/src/app/gallery/album/album.component.css
index 2e7c142..72d23c8 100644
--- a/src/app/gallery/album/album.component.css
+++ b/src/app/gallery/album/album.component.css
@@ -9,3 +9,15 @@
float: left;
width: 510px;
}
+
+.align.right {
+ float: right;
+}
+
+.align.left {
+ float: left;
+}
+
+h1 {
+ padding-right: 15px;
+}
\ No newline at end of file
diff --git a/src/app/gallery/album/album.component.html b/src/app/gallery/album/album.component.html
index 477311b..fbd9c04 100644
--- a/src/app/gallery/album/album.component.html
+++ b/src/app/gallery/album/album.component.html
@@ -1,5 +1,5 @@
-
{{album.name}}
+
;
+
+ private leftHeight: number = 0;
+ private middleHeight: number = 0;
+ private rightHeight: number = 0;
+
+ public thumbnailsLeft: Array = [];
+ public thumbnailsMiddle: Array = [];
+ public thumbnailsRight: Array = [];
constructor(private titleService: Title,
private route: ActivatedRoute,
@@ -26,7 +37,7 @@ export class AlbumComponent implements OnInit {
this.route.data.subscribe((data: { albums: Array}) => {
this.album = data.albums.find(album => album.slug == this.route.snapshot.params.slug);
this.titleService.setTitle(`${this.album.name} - photos.yvan.hu`);
- this.thumbnails = this.initThumbnails();
+ this.initThumbnails();
if(this.route.snapshot.params.image) {
this.imageClick(
this.route.snapshot.params.slug,
@@ -36,8 +47,8 @@ export class AlbumComponent implements OnInit {
});
}
- private initThumbnails(): Array {
- return this.album.images.map(image => {
+ private initThumbnails() {
+ this.album.images.map(image => {
slug: '',
image: this.imageUrl(image),
path: image.path,
@@ -46,36 +57,27 @@ export class AlbumComponent implements OnInit {
extraRight: '',
extraLeft: '',
},
+ height: image.height,
+ }).map(thumbnail => {
+ let heights = [this.leftHeight, this.middleHeight, this.rightHeight];
+ let idx = heights.reduce((low, nxt, idx) => nxt < heights[low] ? idx : low, 0);
+ switch(idx) {
+ case IDX_LEFT:
+ this.thumbnailsLeft.push(thumbnail);
+ this.leftHeight += (thumbnail.height + 10);
+ break;
+ case IDX_MIDDLE:
+ this.thumbnailsMiddle.push(thumbnail);
+ this.middleHeight += (thumbnail.height + 10);
+ break;
+ case IDX_RIGHT:
+ this.thumbnailsRight.push(thumbnail);
+ this.rightHeight += (thumbnail.height + 10);
+ break;
+ }
});
}
- get thumbnailsLeft(): Array {
- let thumbs = [];
- for (let i=0;i {
- let thumbs = [];
- for (let i=1;i {
- let thumbs = [];
- for (let i=2;i
Albums
-
+ [routerLink]="['/album', thumbnail.slug]">
-
+ [routerLink]="['/album', thumbnail.slug]">
-
+ [routerLink]="['/album', thumbnail.slug]">
diff --git a/src/app/gallery/gallery/gallery.component.ts b/src/app/gallery/gallery/gallery.component.ts
index 890bfa5..04fd645 100644
--- a/src/app/gallery/gallery/gallery.component.ts
+++ b/src/app/gallery/gallery/gallery.component.ts
@@ -23,7 +23,7 @@ export class GalleryComponent implements OnInit {
ngOnInit() {
this.titleService.setTitle('Albums - photos.yvan.hu');
this.route.data.subscribe((data: { albums: Array
}) => {
- this.albums = data.albums;
+ this.albums = data.albums.filter(album => album.isPublic).reverse();
this.thumbnails = this.initThumbnails();
});
}
diff --git a/src/app/gallery/shared/image.model.ts b/src/app/gallery/shared/image.model.ts
index b4b2f66..123ed67 100644
--- a/src/app/gallery/shared/image.model.ts
+++ b/src/app/gallery/shared/image.model.ts
@@ -1,4 +1,7 @@
export class Image {
+ public dir: string = "";
public label: string = "";
public path: string = "";
+ public width: number = 0;
+ public height: number = 0;
}
diff --git a/src/app/gallery/shared/thumbnail.model.ts b/src/app/gallery/shared/thumbnail.model.ts
index 096af2c..ad26199 100644
--- a/src/app/gallery/shared/thumbnail.model.ts
+++ b/src/app/gallery/shared/thumbnail.model.ts
@@ -5,4 +5,5 @@ export class Thumbnail {
public image: string = '';
public path: string = '';
public label: ThumbLabel = new ThumbLabel();
+ public height: number = 0;
}
diff --git a/src/app/gallery/thumbnail/thumbnail.component.ts b/src/app/gallery/thumbnail/thumbnail.component.ts
index 62036a7..5571078 100644
--- a/src/app/gallery/thumbnail/thumbnail.component.ts
+++ b/src/app/gallery/thumbnail/thumbnail.component.ts
@@ -3,7 +3,7 @@ import {Component, Input, OnInit} from '@angular/core';
import {ThumbLabel} from "../shared/thumb-label.model";
@Component({
- selector: 'app-thumbnail',
+ selector: 'app-thumbnail, [app-thumbnail]',
templateUrl: './thumbnail.component.html',
styleUrls: ['./thumbnail.component.css']
})
diff --git a/src/styles.css b/src/styles.css
index 3f7ee86..96bbbd5 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -48,18 +48,18 @@ a:hover {
/* app style */
@media screen and (min-width: 600px) {
.main.container {
- width: 540px;
+ width: 515px;
}
}
@media screen and (min-width: 1200px) {
.main.container {
- width: 1060px;
+ width: 1030px;
}
}
@media screen and (min-width: 1600px) {
.main.container {
- width: 1580px;
+ width: 1545px;
}
}