Commit cc582652 authored by Thibaut Girka's avatar Thibaut Girka Committed by ThibG

[Glitch] Ensure link thumbnails are not stretched to super low quality

Port front-end changes from c36b9cc5 to glitch-soc
parent 49eaf72f
......@@ -59,6 +59,8 @@ export default class Card extends React.PureComponent {
renderLink () {
const { card, maxDescription } = this.props;
const { width } = this.state;
const horizontal = card.get('width') > card.get('height') && (card.get('width') + 100 >= width);
let image = '';
let provider = card.get('provider_name');
......@@ -75,17 +77,15 @@ export default class Card extends React.PureComponent {
provider = decodeIDNA(getHostname(card.get('url')));
}
const className = classnames('status-card', {
'horizontal': card.get('width') > card.get('height'),
});
const className = classnames('status-card', { horizontal });
return (
<a href={card.get('url')} className={className} target='_blank' rel='noopener'>
<a href={card.get('url')} className={className} target='_blank' rel='noopener' ref={this.setRef}>
{image}
<div className='status-card__content'>
<strong className='status-card__title' title={card.get('title')}>{card.get('title')}</strong>
<p className='status-card__description'>{(card.get('description') || '').substring(0, maxDescription)}</p>
{!horizontal && <p className='status-card__description'>{(card.get('description') || '').substring(0, maxDescription)}</p>}
<span className='status-card__host'>{provider}</span>
</div>
</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment