Add media description (or status spoiler) in account media gallery

main
Thibaut Girka 6 years ago committed by ThibG
parent bd1f08fa9a
commit d82c495c0f

@ -24,7 +24,7 @@ export default class MediaItem extends ImmutablePureComponent {
const y = ((focusY / -2) + .5) * 100; const y = ((focusY / -2) + .5) * 100;
const style = {}; const style = {};
let label, icon; let label, icon, title;
if (media.get('type') === 'gifv') { if (media.get('type') === 'gifv') {
label = <span className='media-gallery__gifv__label'>GIF</span>; label = <span className='media-gallery__gifv__label'>GIF</span>;
@ -33,17 +33,24 @@ export default class MediaItem extends ImmutablePureComponent {
if (visible) { if (visible) {
style.backgroundImage = `url(${media.get('preview_url')})`; style.backgroundImage = `url(${media.get('preview_url')})`;
style.backgroundPosition = `${x}% ${y}%`; style.backgroundPosition = `${x}% ${y}%`;
title = media.get('description');
} else { } else {
icon = ( icon = (
<span className='account-gallery__item__icons'> <span className='account-gallery__item__icons'>
<i className='fa fa-eye-slash' /> <i className='fa fa-eye-slash' />
</span> </span>
); );
title = status.get('spoiler_text') || media.get('description');
} }
return ( return (
<div className='account-gallery__item'> <div className='account-gallery__item'>
<Permalink to={`/statuses/${status.get('id')}`} href={status.get('url')} style={style}> <Permalink
to={`/statuses/${status.get('id')}`}
href={status.get('url')}
style={style}
title={title}
>
{icon} {icon}
{label} {label}
</Permalink> </Permalink>

Loading…
Cancel
Save