1
0
puyopuyotetr.is/app/javascript/mastodon/components/inline_account.jsx

38 lines
863 B
React
Raw Normal View History

2023-05-23 17:52:27 +09:00
import { PureComponent } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { Avatar } from 'mastodon/components/avatar';
import { makeGetAccount } from 'mastodon/selectors';
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId),
});
return mapStateToProps;
};
2023-05-23 17:52:27 +09:00
class InlineAccount extends PureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
};
render () {
const { account } = this.props;
return (
<span className='inline-account'>
<Avatar size={13} account={account} /> <strong>{account.get('username')}</strong>
</span>
);
}
}
export default connect(makeMapStateToProps)(InlineAccount);