logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

avatar_overlay.js (994B)


  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import ImmutablePropTypes from 'react-immutable-proptypes';
  4. import { autoPlayGif } from '../initial_state';
  5. export default class AvatarOverlay extends React.PureComponent {
  6. static propTypes = {
  7. account: ImmutablePropTypes.map.isRequired,
  8. friend: ImmutablePropTypes.map.isRequired,
  9. animate: PropTypes.bool,
  10. };
  11. static defaultProps = {
  12. animate: autoPlayGif,
  13. };
  14. render() {
  15. const { account, friend, animate } = this.props;
  16. const baseStyle = {
  17. backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`,
  18. };
  19. const overlayStyle = {
  20. backgroundImage: `url(${friend.get(animate ? 'avatar' : 'avatar_static')})`,
  21. };
  22. return (
  23. <div className='account__avatar-overlay'>
  24. <div className='account__avatar-overlay-base' style={baseStyle} />
  25. <div className='account__avatar-overlay-overlay' style={overlayStyle} />
  26. </div>
  27. );
  28. }
  29. }