~cytrogen/masto-fe

ref: 434712ea2279340f671bac234fdac264367f935a masto-fe/app/javascript/flavours/glitch/components/inline_account.jsx -rw-r--r-- 877 bytes
434712ea — Cytrogen Convert glitch component SCSS to CSS custom properties (Phase 5+6) 14 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { PureComponent } from "react";

import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";

import { Avatar } from "flavours/glitch/components/avatar";
import { makeGetAccount } from "flavours/glitch/selectors";

const makeMapStateToProps = () => {
  const getAccount = makeGetAccount();

  const mapStateToProps = (state, { accountId }) => ({
    account: getAccount(state, accountId),
  });

  return mapStateToProps;
};

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);