1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/ui/gallery/directories/directories.component.ts
2019-03-03 12:11:36 +01:00

28 lines
731 B
TypeScript

import {Component, ElementRef, Input, OnChanges, OnInit} from '@angular/core';
import {DirectoryDTO} from '../../../../../common/entities/DirectoryDTO';
@Component({
selector: 'app-gallery-directories',
templateUrl: './directories.component.html',
styleUrls: ['./directories.component.css']
})
export class DirectoriesComponent implements OnChanges {
@Input() directories: DirectoryDTO[];
size: number;
constructor(private container: ElementRef) {
}
ngOnChanges() {
this.updateSize();
}
private updateSize() {
const size = 220 + 5;
const containerWidth = this.container.nativeElement.parentElement.clientWidth;
this.size = (containerWidth / Math.round((containerWidth / size))) - 5;
}
}