Updated all basic components
removed unnecessary components, combined where necessary added each component to a folder, added individual css style modules optimized some component rendering flows removed functional components in favor of pure components linted and formatted all of the files
This commit is contained in:
33
app/javascript/gabsocial/components/avatar_overlay/index.js
Normal file
33
app/javascript/gabsocial/components/avatar_overlay/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { autoPlayGif } from '../../initial_state';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
export default class AvatarOverlay extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
account: ImmutablePropTypes.map.isRequired,
|
||||
friend: ImmutablePropTypes.map.isRequired,
|
||||
animate: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
animate: autoPlayGif,
|
||||
};
|
||||
|
||||
render() {
|
||||
const { account, friend, animate } = this.props;
|
||||
|
||||
const baseSrc = account.get(animate ? 'avatar' : 'avatar_static');
|
||||
const overlaySrc = friend.get(animate ? 'avatar' : 'avatar_static');
|
||||
|
||||
return (
|
||||
<div className='avatar-overlay'>
|
||||
<img className='avatar-overlay__base' src={baseSrc} />
|
||||
<img className='avatar-overlay__overlay' src={overlaySrc} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user