From f35c090caaccf272c12358a2a02df71b9212d16c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 18 Jun 2021 02:27:32 +0300 Subject: merged in compact notifs and improved upon it --- src/components/gallery/gallery.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/components/gallery/gallery.js') diff --git a/src/components/gallery/gallery.js b/src/components/gallery/gallery.js index cca67dbd..ab13f698 100644 --- a/src/components/gallery/gallery.js +++ b/src/components/gallery/gallery.js @@ -6,6 +6,7 @@ const Gallery = { 'attachments', 'limitRows', 'descriptions', + 'limit', 'nsfw', 'setMedia', 'size', @@ -26,11 +27,14 @@ const Gallery = { if (!this.attachments) { return [] } + console.log(this.limit) + const attachments = this.limit > 0 + ? this.attachments.slice(0, this.limit) + : this.attachments if (this.size === 'hide') { - return this.attachments.map(item => ({ minimal: true, items: [item] })) + return attachments.map(item => ({ minimal: true, items: [item] })) } - const rows = this.attachments.reduce((acc, attachment, i) => { - if (this.size === 'small' && acc.length === 2) return acc + const rows = attachments.reduce((acc, attachment, i) => { if (attachment.mimetype.includes('audio')) { return [...acc, { audio: true, items: [attachment] }, { items: [] }] } -- cgit v1.2.3-70-g09d2