}
render () {
- const { src, size, staticSrc, animate } = this.props;
+ const { src, size, staticSrc, animate, inline } = this.props;
const { hovering } = this.state;
+ let className = 'account__avatar';
+
+ if (inline) {
+ className = className + ' account__avatar-inline';
+ }
+
const style = {
...this.props.style,
width: `${size}px`,
return (
<div
- className='account__avatar'
+ className={className}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
style={style}
staticSrc: PropTypes.string,
size: PropTypes.number.isRequired,
style: PropTypes.object,
- animate: PropTypes.bool
+ animate: PropTypes.bool,
+ inline: PropTypes.bool
};
Avatar.defaultProps = {
- animate: false
+ animate: false,
+ size: 20,
+ inline: false
};
export default Avatar;
--- /dev/null
+import React from 'react';
+import PropTypes from 'prop-types';
+
+class AvatarOverlay extends React.PureComponent {
+ render() {
+ const {staticSrc, overlaySrc} = this.props;
+
+ const baseStyle = {
+ backgroundImage: `url(${staticSrc})`
+ };
+
+ const overlayStyle = {
+ backgroundImage: `url(${overlaySrc})`
+ };
+
+ return (
+ <div className='account__avatar-overlay'>
+ <div className="account__avatar-overlay-base" style={baseStyle} />
+ <div className="account__avatar-overlay-overlay" style={overlayStyle} />
+ </div>
+ );
+ }
+}
+
+AvatarOverlay.propTypes = {
+ staticSrc: PropTypes.string.isRequired,
+ overlaySrc: PropTypes.string.isRequired,
+};
+
+export default AvatarOverlay;
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Avatar from './avatar';
+import AvatarOverlay from './avatar_overlay';
import RelativeTimestamp from './relative_timestamp';
import DisplayName from './display_name';
import MediaGallery from './media_gallery';
render () {
let media = '';
- const { status, ...other } = this.props;
+ let statusAvatar;
+ const { status, account, ...other } = this.props;
if (status === null) {
return <div />;
<FormattedMessage id='status.reblogged_by' defaultMessage='{name} boosted' values={{ name: <a onClick={this.handleAccountClick.bind(this, status.getIn(['account', 'id']))} href={status.getIn(['account', 'url'])} className='status__display-name muted'><strong dangerouslySetInnerHTML={displayNameHTML} /></a> }} />
</div>
- <Status {...other} wrapped={true} status={status.get('reblog')} />
+ <Status {...other} wrapped={true} status={status.get('reblog')} account={status.get('account')} />
</div>
);
}
}
}
+ if (account === undefined || account === null) {
+ statusAvatar = <Avatar src={status.getIn(['account', 'avatar'])} staticSrc={status.getIn(['account', 'avatar_static'])} size={48}/>;
+ }else{
+ statusAvatar = <AvatarOverlay staticSrc={status.getIn(['account', 'avatar_static'])} overlaySrc={account.get('avatar_static')} />;
+ }
+
return (
<div className={this.props.muted ? 'status muted' : 'status'}>
<div className='status__info'>
<a onClick={this.handleAccountClick.bind(this, status.getIn(['account', 'id']))} href={status.getIn(['account', 'url'])} className='status__display-name'>
<div className='status__avatar'>
- <Avatar src={status.getIn(['account', 'avatar'])} staticSrc={status.getIn(['account', 'avatar_static'])} size={48} />
+ {statusAvatar}
</div>
<DisplayName account={status.get('account')} />
Status.propTypes = {
status: ImmutablePropTypes.map,
+ account: ImmutablePropTypes.map,
wrapped: PropTypes.bool,
onReply: PropTypes.func,
onFavourite: PropTypes.func,
import ImmutablePropTypes from 'react-immutable-proptypes';
import StatusContainer from '../../../containers/status_container';
import AccountContainer from '../../../containers/account_container';
+import Avatar from '../../../components/avatar';
import { FormattedMessage } from 'react-intl';
import Permalink from '../../../components/permalink';
import emojify from '../../../emoji';
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-star star-icon'/>
</div>
-
<FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} />
</div>
- <StatusContainer id={notification.get('status')} muted={true} />
+ <StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} />
</div>
);
}
<div className='notification__favourite-icon-wrapper'>
<i className='fa fa-fw fa-retweet' />
</div>
-
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
</div>
- <StatusContainer id={notification.get('status')} muted={true} />
+ <StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} />
</div>
);
}
--- /dev/null
+@mixin avatar-radius() {
+ border-radius: 4px;
+ background: transparent no-repeat;
+ background-position: 50%;
+ background-clip: padding-box;
+}
+
+@mixin avatar-size($size:48px) {
+ width: $size;
+ height: $size;
+ background-size: $size $size;
+}
+@import 'mixins';
@import 'variables';
@import 'fonts/roboto';
@import 'fonts/roboto-mono';
}
.account__avatar {
- border-radius: 4px;
- background: transparent no-repeat;
- background-position: 50%;
- background-clip: padding-box;
+ @include avatar-radius();
position: relative;
+
+ &-inline {
+ display: inline-block;
+ vertical-align: middle;
+ margin-right: 5px;
+ }
+}
+
+.account__avatar-overlay {
+ @include avatar-size(48px);
+
+ &-base {
+ @include avatar-radius();
+ @include avatar-size(36px);
+ }
+
+ &-overlay {
+ @include avatar-radius();
+ @include avatar-size(24px);
+
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ z-index: 1;
+ }
}
.account__relationship {