From ba326f95528975629b18433a5b13a5cca157f14e Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 23 May 2023 21:10:19 -0700 Subject: [PATCH] albums: allow 2 columns Signed-off-by: Varun Patil --- src/components/ClusterGrid.vue | 7 ++++++- src/components/ClusterView.vue | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/ClusterGrid.vue b/src/components/ClusterGrid.vue index 08c9802b..f633940e 100644 --- a/src/components/ClusterGrid.vue +++ b/src/components/ClusterGrid.vue @@ -41,6 +41,10 @@ export default defineComponent({ type: Number, default: 180, }, + minCols: { + type: Number, + default: 3, + }, link: { type: Boolean, default: true, @@ -90,8 +94,9 @@ export default defineComponent({ }, resize() { + // Restrict the number of columns between minCols and the size cap const w = (this.$refs.recycler).$el.clientWidth; - this.gridItems = Math.max(Math.floor(w / this.maxSize), 3); + this.gridItems = Math.max(Math.floor(w / this.maxSize), this.minCols); this.itemSize = Math.floor(w / this.gridItems); }, }, diff --git a/src/components/ClusterView.vue b/src/components/ClusterView.vue index f7dd8589..950a07f0 100644 --- a/src/components/ClusterView.vue +++ b/src/components/ClusterView.vue @@ -6,7 +6,7 @@ - + @@ -48,6 +48,10 @@ export default defineComponent({ noParams() { return !this.$route.params.name && !this.$route.params.user; }, + + minCols() { + return this.$route.name === 'albums' ? 2 : 3; + }, }, mounted() {