gab-social/app/javascript/gabsocial/components/popover/user_info_popover.js

48 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-03-11 23:56:18 +00:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
2020-04-23 07:13:29 +01:00
import { NavLink } from 'react-router-dom'
2020-02-28 15:20:47 +00:00
import PopoverLayout from './popover_layout'
2020-04-23 07:13:29 +01:00
import AccountActionButton from '../account_action_button'
2020-03-11 23:56:18 +00:00
import Avatar from '../avatar'
import DisplayName from '../display_name'
2020-02-28 15:20:47 +00:00
2020-03-11 23:56:18 +00:00
export default class UserInfoPopover extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
}
2020-02-28 15:20:47 +00:00
render() {
2020-03-11 23:56:18 +00:00
const { account } = this.props
const content = !account ? null : { __html: account.get('note_emojified') }
2020-04-23 07:13:29 +01:00
const to = !account ? '' : `/${account.get('acct')}`
// : todo : is remote
2020-03-11 23:56:18 +00:00
2020-02-28 15:20:47 +00:00
return (
2020-04-23 07:13:29 +01:00
<PopoverLayout width={280}>
<div className={[_s.default, _s.width100PC, _s.px15, _s.py15].join(' ')}>
2020-03-11 23:56:18 +00:00
<div className={[_s.default, _s.flexRow].join(' ')}>
2020-04-23 07:13:29 +01:00
<NavLink
to={to}
className={[_s.default, _s.noUnderline, _s.flexGrow1].join(' ')}
>
2020-04-24 04:17:27 +01:00
<Avatar account={account} size={42} noHover />
<DisplayName account={account} isMultiline noHover />
2020-04-23 07:13:29 +01:00
</NavLink>
2020-04-24 04:17:27 +01:00
<div className={[_s.default, _s.mlAuto, _s.right0, _s.posAbs, _s.mt5].join(' ')}>
2020-04-23 07:13:29 +01:00
<AccountActionButton account={account} />
2020-03-11 23:56:18 +00:00
</div>
</div>
2020-04-23 07:13:29 +01:00
<div className={[_s.default, _s.mt10].join(' ')}>
2020-03-11 23:56:18 +00:00
<div className={_s.dangerousContent} dangerouslySetInnerHTML={content} />
</div>
</div>
2020-02-28 15:20:47 +00:00
</PopoverLayout>
)
}
}