summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-31 09:52:18 -0400
committerJoramWilander <jwawilander@gmail.com>2015-07-31 09:52:18 -0400
commitdad78514234029791ff02c9a0efd2cbacdac5280 (patch)
treea930739e16d45e853d1308b9325875da7ef57c33 /web
parent8542fbd1ace1296030dbfaceec774e41a6fe07a1 (diff)
downloadchat-dad78514234029791ff02c9a0efd2cbacdac5280.tar.gz
chat-dad78514234029791ff02c9a0efd2cbacdac5280.tar.bz2
chat-dad78514234029791ff02c9a0efd2cbacdac5280.zip
center small thumbnails and top left larger thumbnails
Diffstat (limited to 'web')
-rw-r--r--web/react/components/file_attachment.jsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx
index 3cd791887..b7ea5734f 100644
--- a/web/react/components/file_attachment.jsx
+++ b/web/react/components/file_attachment.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
var utils = require('../utils/utils.jsx');
+var Constants = require('../utils/constants.jsx');
module.exports = React.createClass({
displayName: "FileAttachment",
@@ -44,6 +45,16 @@ module.exports = React.createClass({
$(imgDiv).removeClass('post__load');
$(imgDiv).addClass('post__image');
+ var width = this.width || $(this).width();
+ var height = this.height || $(this).height();
+
+ if (width < Constants.THUMBNAIL_WIDTH
+ && height < Constants.THUMBNAIL_HEIGHT) {
+ $(imgDiv).addClass('small');
+ } else {
+ $(imgDiv).addClass('normal');
+ }
+
var re1 = new RegExp(' ', 'g');
var re2 = new RegExp('\\(', 'g');
var re3 = new RegExp('\\)', 'g');