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

42 lines
1.1 KiB
JavaScript
Raw Normal View History

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
}
2020-02-24 21:56:07 +00:00
export default
@connect(makeMapStateToProps)
class AutosuggestAccount extends ImmutablePureComponent {
2019-07-02 08:10:25 +01:00
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
2020-04-11 23:29:19 +01:00
}
2019-07-02 08:10:25 +01:00
render () {
const { account } = this.props
2019-07-02 08:10:25 +01:00
return (
<div
className={[_s.default, _s.cursorPointer, _s.bgSubtle_onHover, _s.flexRow, _s.py10, _s.alignItemsCenter, _s.px10, _s.borderBottom1PX, _s.borderColorSecondary].join(' ')}
title={account.get('acct')}
>
<Avatar account={account} size={26} />
<div className={_s.ml10}>
<DisplayName account={account} noRelationship noHover />
</div>
2019-07-02 08:10:25 +01:00
</div>
)
2019-07-02 08:10:25 +01:00
}
}