From 2f079573ed6aed9f27ece623c56a61c8e036574e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 24 Sep 2017 05:58:30 +0200 Subject: In detail status view, display attachment uncropped if there's only one (#5054) * In detail status view, display attachment uncropped if there's only one * Make media spoiler the size of the media it hides, enable on static --- .../mastodon/components/media_gallery.js | 42 +++++++++++++++++----- .../features/status/components/detailed_status.js | 11 +++++- app/javascript/styles/components.scss | 7 ++++ .../stream_entries/_detailed_status.html.haml | 2 +- 4 files changed, 52 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js index 78a2f5dc4..d84e4229c 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/mastodon/components/media_gallery.js @@ -4,6 +4,8 @@ import PropTypes from 'prop-types'; import IconButton from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { isIOS } from '../is_mobile'; +import classNames from 'classnames'; +import sizeMe from 'react-sizeme'; const messages = defineMessages({ toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, @@ -17,6 +19,7 @@ class Item extends React.PureComponent { static propTypes = { attachment: ImmutablePropTypes.map.isRequired, + standalone: PropTypes.bool, index: PropTypes.number.isRequired, size: PropTypes.number.isRequired, onClick: PropTypes.func.isRequired, @@ -25,6 +28,9 @@ class Item extends React.PureComponent { static defaultProps = { autoPlayGif: false, + standalone: false, + index: 0, + size: 1, }; handleMouseEnter = (e) => { @@ -57,7 +63,7 @@ class Item extends React.PureComponent { } render () { - const { attachment, index, size } = this.props; + const { attachment, index, size, standalone } = this.props; let width = 50; let height = 100; @@ -136,7 +142,7 @@ class Item extends React.PureComponent { const autoPlay = !isIOS() && this.props.autoPlayGif; thumbnail = ( -
+