|
|
|
@ -25,16 +25,6 @@ const getHostname = url => {
|
|
|
|
|
return parser.hostname;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const trim = (text, len) => {
|
|
|
|
|
const cut = text.indexOf(' ', len);
|
|
|
|
|
|
|
|
|
|
if (cut === -1) {
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text.slice(0, cut) + (text.length > len ? '…' : '');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const domParser = new DOMParser();
|
|
|
|
|
|
|
|
|
|
const addAutoPlay = html => {
|
|
|
|
@ -62,7 +52,6 @@ export default class Card extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
|
card: ImmutablePropTypes.map,
|
|
|
|
|
maxDescription: PropTypes.number,
|
|
|
|
|
onOpenMedia: PropTypes.func.isRequired,
|
|
|
|
|
compact: PropTypes.bool,
|
|
|
|
|
defaultWidth: PropTypes.number,
|
|
|
|
@ -71,7 +60,6 @@ export default class Card extends React.PureComponent {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
|
maxDescription: 50,
|
|
|
|
|
compact: false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -184,7 +172,7 @@ export default class Card extends React.PureComponent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
const { card, maxDescription, compact } = this.props;
|
|
|
|
|
const { card, compact } = this.props;
|
|
|
|
|
const { width, embedded, revealed } = this.state;
|
|
|
|
|
|
|
|
|
|
if (card === null) {
|
|
|
|
@ -203,7 +191,7 @@ export default class Card extends React.PureComponent {
|
|
|
|
|
const description = (
|
|
|
|
|
<div className='status-card__content' lang={language}>
|
|
|
|
|
{title}
|
|
|
|
|
{!(horizontal || compact) && <p className='status-card__description'>{trim(card.get('description') || '', maxDescription)}</p>}
|
|
|
|
|
{!(horizontal || compact) && <p className='status-card__description' title={card.get('description')}>{card.get('description')}</p>}
|
|
|
|
|
<span className='status-card__host'>{provider}</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|