2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import classnames from 'classnames';
|
2017-07-14 01:18:28 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
|
|
|
thumbnail: ?string, // externally sourced image
|
|
|
|
};
|
2018-01-09 02:15:44 +01:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
class CardMedia extends React.PureComponent<Props> {
|
2017-07-14 01:18:28 +02:00
|
|
|
render() {
|
2018-07-10 18:12:51 +02:00
|
|
|
const { thumbnail } = this.props;
|
2017-07-14 01:18:28 +02:00
|
|
|
|
2018-01-09 02:15:44 +01:00
|
|
|
return (
|
2018-03-26 23:32:43 +02:00
|
|
|
<div
|
2018-07-10 18:12:51 +02:00
|
|
|
style={thumbnail ? { backgroundImage: `url('${thumbnail}')` } : {}}
|
|
|
|
className={classnames('card__media', {
|
|
|
|
'card__media--no-img': !thumbnail,
|
2018-03-26 23:32:43 +02:00
|
|
|
})}
|
|
|
|
>
|
2018-07-10 18:12:51 +02:00
|
|
|
{!thumbnail && <span className="card__media-text">LBRY</span>}
|
2018-01-09 02:15:44 +01:00
|
|
|
</div>
|
|
|
|
);
|
2017-07-14 01:18:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default CardMedia;
|