闭社主体 forked from https://github.com/tootsuite/mastodon
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.

37 lines
994 B

  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. }