2017-05-03 11:43:37 +02:00
|
|
|
import React from 'react';
|
2017-12-13 12:14:03 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2017-08-07 19:44:55 +02:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2017-12-13 12:14:03 +01:00
|
|
|
import { autoPlayGif } from '../initial_state';
|
2017-05-03 11:43:37 +02:00
|
|
|
|
2017-06-23 19:36:54 +02:00
|
|
|
export default class AvatarOverlay extends React.PureComponent {
|
2017-05-20 17:31:47 +02:00
|
|
|
|
2017-05-12 14:44:10 +02:00
|
|
|
static propTypes = {
|
2017-08-07 19:44:55 +02:00
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
friend: ImmutablePropTypes.map.isRequired,
|
2017-12-13 12:14:03 +01:00
|
|
|
animate: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
animate: autoPlayGif,
|
2017-05-12 14:44:10 +02:00
|
|
|
};
|
|
|
|
|
2017-05-03 11:43:37 +02:00
|
|
|
render() {
|
2017-12-13 12:14:03 +01:00
|
|
|
const { account, friend, animate } = this.props;
|
2017-05-03 11:43:37 +02:00
|
|
|
|
|
|
|
const baseStyle = {
|
2017-12-13 12:14:03 +01:00
|
|
|
backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`,
|
2017-05-03 11:43:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const overlayStyle = {
|
2017-12-13 12:14:03 +01:00
|
|
|
backgroundImage: `url(${friend.get(animate ? 'avatar' : 'avatar_static')})`,
|
2017-05-03 11:43:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='account__avatar-overlay'>
|
2017-06-06 03:56:36 +02:00
|
|
|
<div className='account__avatar-overlay-base' style={baseStyle} />
|
|
|
|
<div className='account__avatar-overlay-overlay' style={overlayStyle} />
|
2017-05-03 11:43:37 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-05-12 14:44:10 +02:00
|
|
|
}
|