Merge upstream 2.0ish #165
This commit is contained in:
@@ -30,6 +30,10 @@ export default class Card extends React.PureComponent {
|
||||
maxDescription: 50,
|
||||
};
|
||||
|
||||
state = {
|
||||
width: 0,
|
||||
};
|
||||
|
||||
renderLink () {
|
||||
const { card, maxDescription } = this.props;
|
||||
|
||||
@@ -75,14 +79,25 @@ export default class Card extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
setRef = c => {
|
||||
if (c) {
|
||||
this.setState({ width: c.offsetWidth });
|
||||
}
|
||||
}
|
||||
|
||||
renderVideo () {
|
||||
const { card } = this.props;
|
||||
const content = { __html: card.get('html') };
|
||||
const { card } = this.props;
|
||||
const content = { __html: card.get('html') };
|
||||
const { width } = this.state;
|
||||
const ratio = card.get('width') / card.get('height');
|
||||
const height = card.get('width') > card.get('height') ? (width / ratio) : (width * ratio);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={this.setRef}
|
||||
className='status-card-video'
|
||||
dangerouslySetInnerHTML={content}
|
||||
style={{ height }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import StatusContent from '../../../../glitch/components/status/content';
|
||||
import StatusGallery from '../../../../glitch/components/status/gallery';
|
||||
import StatusPlayer from '../../../../glitch/components/status/player';
|
||||
import AttachmentList from '../../../components/attachment_list';
|
||||
import Link from 'react-router-dom/Link';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { FormattedDate, FormattedNumber } from 'react-intl';
|
||||
import CardContainer from '../containers/card_container';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
Reference in New Issue
Block a user