From e11b5cc72872e7f933c7cf57bd160a54dcd04413 Mon Sep 17 00:00:00 2001 From: Tuur Lievens Date: Sun, 13 Sep 2020 13:32:46 +0200 Subject: [PATCH] Improve mobile directory grid layout --- .../ui/gallery/directories/directories.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frontend/app/ui/gallery/directories/directories.component.ts b/src/frontend/app/ui/gallery/directories/directories.component.ts index 10c5c4d2..d0238b55 100644 --- a/src/frontend/app/ui/gallery/directories/directories.component.ts +++ b/src/frontend/app/ui/gallery/directories/directories.component.ts @@ -19,9 +19,13 @@ export class DirectoriesComponent implements OnChanges { } private updateSize() { - const size = 220 + 5; - const containerWidth = this.container.nativeElement.parentElement.clientWidth; - this.size = (containerWidth / Math.round((containerWidth / size))) - 5; + if (window.innerWidth < window.innerHeight) { + // On portrait mode, show 2 directories side by side with some padding + this.size = Math.round(window.innerWidth / 2) - 25; + } else { + const size = 220 + 5; + const containerWidth = this.container.nativeElement.parentElement.clientWidth; + this.size = (containerWidth / Math.round((containerWidth / size))) - 5; + } } - }