albums: allow 2 columns

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/672/head
Varun Patil 2023-05-23 21:10:19 -07:00
parent e69422b37a
commit ba326f9552
2 changed files with 11 additions and 2 deletions

View File

@ -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 = (<any>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);
},
},

View File

@ -6,7 +6,7 @@
<EmptyContent v-if="!items.length && !loading" />
<ClusterGrid :items="items" />
<ClusterGrid :items="items" :minCols="minCols" />
</div>
<Timeline v-else />
@ -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() {