2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-08-17 21:39:25 +01:00
|
|
|
import { connect } from 'react-redux'
|
2020-06-16 03:59:48 +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'
|
2019-08-09 17:06:27 +01:00
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
class AutosuggestAccount extends ImmutablePureComponent {
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
render () {
|
2020-06-16 03:59:48 +01:00
|
|
|
const { account } = this.props
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
return (
|
2020-06-16 03:59:48 +01:00
|
|
|
<div
|
2020-08-18 21:49:11 +01:00
|
|
|
className={[_s.d, _s.cursorPointer, _s.bgSubtle_onHover, _s.flexRow, _s.py10, _s.aiCenter, _s.px10, _s.borderBottom1PX, _s.borderColorSecondary].join(' ')}
|
2020-06-16 03:59:48 +01:00
|
|
|
title={account.get('acct')}
|
|
|
|
>
|
|
|
|
<Avatar account={account} size={26} />
|
|
|
|
<div className={_s.ml10}>
|
|
|
|
<DisplayName account={account} noRelationship noHover />
|
2019-08-07 06:02:36 +01:00
|
|
|
</div>
|
2019-07-02 08:10:25 +01:00
|
|
|
</div>
|
2020-06-16 03:59:48 +01:00
|
|
|
)
|
2019-07-02 08:10:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-08-18 01:57:35 +01:00
|
|
|
|
2020-08-20 16:26:00 +01:00
|
|
|
const mapStateToProps = (state, { id }) => ({
|
2020-08-18 01:57:35 +01:00
|
|
|
account: makeGetAccount()(state, id),
|
|
|
|
})
|
|
|
|
|
|
|
|
AutosuggestAccount.propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(AutosuggestAccount)
|