Continuing updating the reformatting of propTypes and set redux, intl functions to end of component
• Removing: - the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
@@ -8,46 +8,19 @@ import { autoPlayGif } from '../initial_state'
|
||||
import { openPopover, closePopover } from '../actions/popover'
|
||||
import Image from './image'
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
openUserInfoPopover(props) {
|
||||
dispatch(openPopover('USER_INFO', props))
|
||||
},
|
||||
closeUserInfoPopover() {
|
||||
dispatch(closePopover('USER_INFO'))
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Renders an avatar component
|
||||
* @param {map} [props.account] - the account for image
|
||||
* @param {number} [props.size=40] - the size of the avatar
|
||||
*/
|
||||
export default
|
||||
@connect(null, mapDispatchToProps)
|
||||
class Avatar extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
account: ImmutablePropTypes.map,
|
||||
noHover: PropTypes.bool,
|
||||
openUserInfoPopover: PropTypes.func.isRequired,
|
||||
size: PropTypes.number,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
size: 40,
|
||||
}
|
||||
|
||||
state = {
|
||||
hovering: false,
|
||||
sameImg: !this.props.account ? false : this.props.account.get('avatar') === this.props.account.get('avatar_static'),
|
||||
}
|
||||
|
||||
updateOnProps = [
|
||||
'account',
|
||||
'noHover',
|
||||
'size',
|
||||
]
|
||||
|
||||
mouseOverTimeout = null
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
@@ -143,3 +116,25 @@ class Avatar extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
openUserInfoPopover(props) {
|
||||
dispatch(openPopover('USER_INFO', props))
|
||||
},
|
||||
closeUserInfoPopover() {
|
||||
dispatch(closePopover('USER_INFO'))
|
||||
}
|
||||
})
|
||||
|
||||
Avatar.propTypes = {
|
||||
account: ImmutablePropTypes.map,
|
||||
noHover: PropTypes.bool,
|
||||
openUserInfoPopover: PropTypes.func.isRequired,
|
||||
size: PropTypes.number,
|
||||
}
|
||||
|
||||
Avatar.defaultProps = {
|
||||
size: 40,
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(Avatar)
|
||||
Reference in New Issue
Block a user