gab-social/app/javascript/gabsocial/components/autosuggest_account/autosuggest_account.js

38 lines
954 B
JavaScript
Raw Normal View History

2019-07-02 08:10:25 +01:00
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { makeGetAccount } from '../../selectors';
import Avatar from '../avatar';
import DisplayName from '../display_name';
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
const mapStateToProps = (state, { id }) => ({
account: getAccount(state, id),
});
return mapStateToProps;
};
export default @connect(makeMapStateToProps)
class AutosuggestAccount extends ImmutablePureComponent {
2019-07-02 08:10:25 +01:00
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
};
render () {
const { account } = this.props;
return (
<div className='autosuggest-account' title={account.get('acct')}>
<div className='autosuggest-account__icon'>
<Avatar account={account} size={18} />
</div>
2019-07-02 08:10:25 +01:00
<DisplayName account={account} />
</div>
);
}
}