mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Use the 300x300 thumbnail if available
This commit is contained in:
parent
1e83de0b90
commit
ce9493e3dd
@ -13,7 +13,7 @@ let AccordionListItemPiece = React.createClass({
|
|||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
artistName: React.PropTypes.string,
|
artistName: React.PropTypes.string,
|
||||||
piece: React.PropTypes.object,
|
piece: React.PropTypes.object.isRequired,
|
||||||
children: React.PropTypes.oneOfType([
|
children: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
React.PropTypes.element
|
React.PropTypes.element
|
||||||
@ -51,17 +51,21 @@ let AccordionListItemPiece = React.createClass({
|
|||||||
piece,
|
piece,
|
||||||
subsubheading,
|
subsubheading,
|
||||||
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
|
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
|
||||||
const { url, url_safe } = piece.thumbnail;
|
const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail;
|
||||||
|
|
||||||
|
// Display the 300x300 thumbnail if we have it, otherwise just use the safe url
|
||||||
|
const thumbnailDisplayUrl = (piece.thumbnail.thumbnail_sizes && piece.thumbnail.thumbnail_sizes['300x300']) || thumbnailSafeUrl;
|
||||||
|
|
||||||
let thumbnail;
|
let thumbnail;
|
||||||
|
|
||||||
// Since we're going to refactor the thumbnail generation anyway at one point,
|
// Since we're going to refactor the thumbnail generation anyway at one point,
|
||||||
// for not use the annoying ascribe_spiral.png, we're matching the url against
|
// for not use the annoying ascribe_spiral.png, we're matching the url against
|
||||||
// this name and replace it with a CSS version of the new logo.
|
// this name and replace it with a CSS version of the new logo.
|
||||||
if (url.match(/https:\/\/.*\/media\/thumbnails\/ascribe_spiral.png/)) {
|
if (thumbnailUrl.match(/https:\/\/.*\/media\/thumbnails\/ascribe_spiral.png/)) {
|
||||||
thumbnail = (<ThumbnailPlaceholder />);
|
thumbnail = (<ThumbnailPlaceholder />);
|
||||||
} else {
|
} else {
|
||||||
thumbnail = (
|
thumbnail = (
|
||||||
<div style={{backgroundImage: 'url("' + url_safe + '")'}}/>
|
<div style={{backgroundImage: 'url("' + thumbnailDisplayUrl + '")'}} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +83,7 @@ let AccordionListItemPiece = React.createClass({
|
|||||||
subsubheading={subsubheading}
|
subsubheading={subsubheading}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
badge={badge}
|
badge={badge}
|
||||||
linkData={this.getLinkData()}
|
linkData={this.getLinkData()}>
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</AccordionListItem>
|
</AccordionListItem>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user