The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
974 B

  1. import React from 'react';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import ImmutablePureComponent from 'react-immutable-pure-component';
  4. import Permalink from '../../../components/permalink';
  5. class MediaItem extends ImmutablePureComponent {
  6. static propTypes = {
  7. media: ImmutablePropTypes.map.isRequired,
  8. };
  9. render () {
  10. const { media } = this.props;
  11. const status = media.get('status');
  12. let content, style;
  13. if (media.get('type') === 'gifv') {
  14. content = <span className='media-gallery__gifv__label'>GIF</span>;
  15. }
  16. if (!status.get('sensitive')) {
  17. style = { backgroundImage: `url(${media.get('preview_url')})` };
  18. }
  19. return (
  20. <div className='account-gallery__item'>
  21. <Permalink
  22. to={`/statuses/${status.get('id')}`}
  23. href={status.get('url')}
  24. style={style}
  25. >
  26. {content}
  27. </Permalink>
  28. </div>
  29. );
  30. }
  31. }
  32. export default MediaItem;