diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-11-06 17:44:28 +0100 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-11-09 14:50:08 +0100 |
commit | bf92e7aaa6cc6902130fcf064ea225d860c4d023 (patch) | |
tree | f95bae96b4f77b2744e8313cc33c1cc952a59213 /app/javascript/flavours/glitch/features/list_adder/components/account.js | |
parent | 34209c0340ca6b7c61de964a17f5f3fe2e0f7c7b (diff) |
[Glitch] Implement adding a user to a list from their profile
Port bb5558de627ca9bc26949570025f6193cd7cbd98 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/features/list_adder/components/account.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/list_adder/components/account.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/list_adder/components/account.js b/app/javascript/flavours/glitch/features/list_adder/components/account.js new file mode 100644 index 000000000..1369aac07 --- /dev/null +++ b/app/javascript/flavours/glitch/features/list_adder/components/account.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { makeGetAccount } from '../../../selectors'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import Avatar from '../../../components/avatar'; +import DisplayName from '../../../components/display_name'; +import { injectIntl } from 'react-intl'; + +const makeMapStateToProps = () => { + const getAccount = makeGetAccount(); + + const mapStateToProps = (state, { accountId }) => ({ + account: getAccount(state, accountId), + }); + + return mapStateToProps; +}; + + +export default @connect(makeMapStateToProps) +@injectIntl +class Account extends ImmutablePureComponent { + + static propTypes = { + account: ImmutablePropTypes.map.isRequired, + }; + + render () { + const { account } = this.props; + return ( + <div className='account'> + <div className='account__wrapper'> + <div className='account__display-name'> + <div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div> + <DisplayName account={account} /> + </div> + </div> + </div> + ); + } + +} |